saveFile(filePath, data, [options]) Last updated: 21. Apr 2026
API only function
Saves a file to Docly document according to specified schema. Overwrites if it already exists.
Parameters
| Name | Type | Description |
|---|---|---|
| filePath | string | Absolute path to where you want to save data. |
| data | object | Data to store, will be converted to JSON and stored. |
| options (optional) | object | Specify any of the following options parameters: |
| • schema | string | Absolute path to your Docly schema to store the file as. Required for new files, for updating existing file it is not required. |
| • ensurePath | bool | If true the folder path will be created if it is missing. Default is false. |
| • embedBase64 | bool | If true, base64-encoded content in the data will be extracted and stored as separate embedded attachments, referenced via CID links in the saved document. This reduces document size and improves performance for binary content like images or files. Default is false. |
Returns
An object with references to the saved file with:
- timestamp
- guid
- filename
* Filename may be needed if autogenerated filenames are used.
Example
Code example (#JS)
#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.Demo not available
For more info see:
https://developers.docly.net/JavaScript-examples/Data/Save-data-to-Docly-from-API-function