Filesystem functions

Functions to link files and images from Docly to your web content.

Ext­ract­Ba­se6­4Ima­ge­s(html)
This function extracts images encoded in base64 from an HTML string. It then converts these images to a more storage-efficient format by saving them separately as embedded files. The revised HTML string will reference these images using a Content ID (CID) mechanism, similar to how images are referenced in email attachments.
Crea­teFo­lde­r(folderPath, folderType, folderData)
Creates a folder (also parent folders if missing) from specified path.
De­lete­Fil­e(filePath)
Deletes a specified file.
De­lete­Fol­d­er(folderPath)
Deletes a specified folder.
Fi­leE­xist­s(filePath)
Check whether a file exists or not within the site.
Fol­derE­xi­st­s(path)
Check whether a folder exists or not within your site.
Ge­tEm­bed­de­dFi­le(path, id)
Get bytes of an embedded file (image or file upload) in a specific document.
Ge­tEm­bed­de­dText­Fil­e(path, id, encoding)
Get the size of an embedded file (image or file upload) in a specific document.
Inc­lude(path, template)
Include a file or template into another page.
Ge­tEm­bed­de­dFi­leSi­ze(path, id)
Get the size of an embedded file (image or file upload) in a specific document.
Get­File­s(path, searchPattern, depth, mode)
Gets a list of files from folder / optionally recursively from subfolders.
Get­Fol­der(path)
Returns information about a folder by given path.
Get­Fol­der­s(path, searchPattern, depth)
Gets a list of all subfolders below a specific folder.
Get­File(filepath, metadata)
Gets information about a specific file.
GetJ­son(filepath)
Loads a JSON file and returns the content as an object.
Link­File(embeddedId, filename)
Creates the link to an embedded file within the current document. This function is only available for display templates for document schemas.
List­File­s(path, searchPattern, tags, recursive, metaOnly)
The fastest function to retrieve a list of files from a specific path.
List­Fol­de­rs(path, searchPattern, recursive, includeCounters)
The fastest function to retrieve a list of folders from a specific path.
Lin­kIma­ge(path, width, height, mode)
Creates a link to an image within a document. Only works from site display templates for documents.
Ima­ge sca­lin­g
Read about the different scaling modes here.
Loa­dEx­cel(filename, column, row, sheet)
Loads data from Excel file into an array of objects.
Mo­veFi­le(filePath, toPath)
Moves a file from one folder to another, and renames it if the name part of the path is changed.
Mo­veFol­de­r(folderPath, destinationPath)
Moves a folder within your site.
Re­name­Fil­e(filePath, newName)
Renames a file.
Sa­veEm­bed­d­ed­File(filePath, filename, data)
Saves an embedded file to an existing Docly document. Note that embedded files that are not referenced by a field in the document will be automatically deleted.
Sa­veFi­le(filePath, data, schema, ensurePath)
Saves a file to Docly document according to specified schema. Overwrites if it already exists.
Patch­Fil­e(filePath, patchData)
Updates/patches an existing file in Docly document according to specified schema. The patch is merged with existing data.
Sa­veJ­son(filePath, data, ensurePath)
Saves data as a JSON file to Docly with specified content stringified to JSON format. This function is ideal for storing structured data in a standardized format. For more advanced document saving with custom schemas, consider using the "SaveFile" function.
LogJ­son(filePath, data)
Creates a new JSON array file or adds a new item to the existing array in the file. This function works as a log, maintaining an array of events. The server automatically adds a timestamp to each log entry.