createZip(content) Last updated: 23. May 2025
API only function
Creates a ZIP-file and adds specified files and folders to it.
Parameters
Name | Type | Description |
---|---|---|
content | object | An object with keys representing the filenames and the value with either the stream or the byte[] data. |
Returns
The compressed data ZIP file as a byte[]
Example
Code example (JS)
JS is normal JavaScript either running in the browser or on the Docly™ server.let somedata = docly.textEncode("testing testing", "utf8"); // Create a byte array from text
let content = {
"Test file 1.txt" : somedata, // Always specifiy byte arrays
"Folder/Another file.txt" : somedata,
"Folder 2/" : null // Create an empty folder
};
let zip = docly.compressFiles(content);
return zip;