Hello @Pribele, Joe ,
ProjFS does not expose a dedicated "hydrate" API that converts a placeholder into a hydrated placeholder. Opening the file and reading its content is the documented path to trigger hydration, so the approach you described is consistent with how ProjFS is designed to work.
The flow is:
- An app opens the projected file and reads the requested byte range.
- ProjFS invokes the provider's
PRJ_GET_FILE_DATA_CBcallback. - The provider returns the data by calling
PrjWriteFileData. - ProjFS writes that data to disk and converts the file into a hydrated placeholder.
This is stated in the callback reference. The Remarks for PRJ_GET_FILE_DATA_CB say: "When ProjFS receives the data it will write it to the file to convert it into a hydrated placeholder." The cache-state documentation walks through the same sequence, where the step "the app reads the content of the file" is what turns it into a hydrated placeholder:
A few additional points:
- There is no explicit hydrate function in the ProjFS function list, so causing a read is the intended way to force the content to be cached. In practice, opening the file and reading at least one byte (or the full range) will drive the callback.
- A hydrated placeholder does not automatically become a full file when it is read. Based on the documented state model, it becomes a full file only when the primary data stream is modified locally, for example when it is opened for write access.
If an explicit hydrate call is a hard requirement, it may be worth evaluating the Cloud Files API instead of ProjFS. The trade-offs are roughly:
- ProjFS: simpler to implement, but no explicit hydrate API, no progress reporting, and no online/offline state indication. Hydration is driven by reading the file.
- Cloud Files API: provides an explicit hydrate call (CfHydratePlaceholder) along with hydration policies, progress reporting, and online/offline indication in File Explorer, at the cost of a more complex implementation. The ProjFS documentation itself points to the Cloud Files API for scenarios that need these features.
So if reading the file to hydrate is sufficient for the scenario, staying on ProjFS is reasonable. If explicit hydration control and richer sync/UI behavior are needed, the Cloud Files API is the better fit.
Let me know if it would help to go deeper on either option. If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation.Thank you.