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.

get­Fol­der­Prop­s(folderPath)

Get a specified folders current properties.

ge­tEm­bed­de­dFol­der­Fi­le(folderPath, embeddedFilename)

Retrieves embedded file content from a folder's property file (.docly) by extracting and decoding the specified file data.

sa­veFol­de­rP­rop­s(folderPath, properties)
sa­veEm­bed­d­ed­Fol­der­Fi­le(folderPath, embeddedFilename, data)

Saves an embedded file to the properties of an existing Docly folder. Note that embedded files that are not referenced by a field in the folder properties document will be automatically deleted.

ext­rac­tAn­d­Em­bed­Base­64I­mage­s(filePath, propertyFilter)

This function extracts images encoded in base64 from HTML properties of a document. It then converts these images to a more storage-efficient format by saving them as embedded files within the document. The revised HTML will reference these images using a Content ID (CID) mechanism, similar to how images are referenced in email attachments.

crea­teZi­p(content)

Creates a ZIP-file and adds specified files and folders to it.

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(embeddedId, 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, embeddedId, 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.