GetEmbeddedFileSize(path, id) Last updated: 16. May 2023
Get the size of an embedded file (image or file upload) in a specific document.
Parameters
Name | Type | Description |
---|---|---|
path | string | Absolute path of Docly document to get embedded file size from. |
id | string | ID of embedded file to get size from. |
Returns
Number, file size in bytes.
Example
Code example (#JS)
#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.#{
// Getting the embedded file size from file name
let p = docly.getFile("Test files/Example file.xlsx");
let fileId = p.File;
let size = docly.getEmbeddedFileSize(p.Url, fileID);
write("File size is " + size + " bytes");
// Getting the embedded file size from a display template
// let size2 = docly.getEmbeddedFileSize(request.filepath, File1);
// write("File size is " + size2 + " bytes);
}#
Output
The #JS code above produces the output shown below:File size is 5710 bytes