File Sync Workflow
Syncing file and image field content between local and remote ProcessWire environments.
What file sync does
Content sync transfers field values as YAML but does not copy file or image binaries. File sync fills that gap: it compares file and image fields between your local ProcessWire install and a remote site, then uploads, downloads, or deletes files to bring them into alignment.
How it works
File sync requires both PW_PATH (local) and PW_REMOTE_URL (remote) to be configured. It reads files from the local site/assets/files/{pageId}/ directory and talks to the remote API for inventory and transfer.
The process for each page:
- The remote API returns an inventory of every file on each file/image field: filename, size, MD5 hash, description, and image dimensions.
- PromptWire compares this against the local files on disk.
- Files that exist locally but not remotely are uploaded (base64-encoded via the API).
- Optionally, files that exist remotely but not locally can be deleted with
deleteRemoteOrphans: true.
Usage
Sync files for the About page to production.
Or use pw_file_sync with localPath pointing to the page's sync directory. Like other write operations, file sync is dry-run by default.
Parameters
| Parameter | Default | Description |
|---|---|---|
localPath | (required) | Path to the page's sync directory. |
targets | "remote" | Currently only remote is supported. |
dryRun | true | Preview what would be synced without transferring. |
deleteRemoteOrphans | false | Remove remote files that don't exist locally. |
Timeouts
File sync operations use a longer timeout (120 seconds vs the standard 60) because base64-encoded uploads can be large. If you're syncing many high-resolution images, consider doing it in batches.