Filesystem functions

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

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)
The fastes function to retreive a list of files 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.
Sa­veJ­son(filePath, data)
Saves a JSON file to Docly with specified data stringified to JSON. See also "SaveFile" - it is a more advanced function to save Docly documents with any specified schema.