GetFile(filepath, [metadata]) Last updated: 02. Aug 2023

Gets information about a specific file.

Parameters

Name Type Description
filepath string Path of file to get information about.
metadata (optional) bool Default true. Merges meta data about the document with the document data.

Returns

Structure with file info, see demo.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#{
    let file = docly.getFile("Test files/Example file.xlsx", true);
    var json = JSON.stringify(file);
    
    // Format indent and line breaks in JSON
    var pretty = docly.formatJSON(json);
    
    // Remove empty lines
    var html = pretty.replace(chr(13), "");
    
    write(html);
}#

Output

The #JS code above produces the output shown below:
{
  "File": "0a4bdde7-e796-4e51-859b-2b7ba13c6f35.xlsx",
  "Tags": [],
  "Url": "/Test-files/Example-file.xlsx",
  "opendoc": "https://docly.net/#DsAdeLq7IJ0CERkggJGIU7A?backurl=https%3a%2f%2fdevelopers.docly.net%2fJavaScript%2fFilesystem-functions%2fGetFile",
  "LastModifiedBy": "r@dops.no",
  "folderpath": "/Test files",
  "DoclyType": "Document",
  "DoclyTypeId": 1,
  "FormName": "Uploaded File",
  "Title": "Example file.xlsx",
  "filename": "Example file.xlsx",
  "file": true,
  "DoclyId": 167557,
  "Guid": "sAdeLq7IJ0CERkggJGIU7A",
  "FormId": 11794,
  "CreatedTime": "2022-12-20T19:09:09.9602572+01:00",
  "LastModified": "2022-12-20T19:11:02.4906438+01:00",
  "Filesize": 5710
}