Skip to content

datasource.zip

Zips one or more files into a single zip file from the MODLR filesystem.

js
datasource.zip(filename, output_filename)

or

js
datasource.zip(filenames, output_filename)

Parameters

  • filename (string): The name of the file you want to zip. (for the single file version)
  • filenames (array): An array of file names you want to zip together. (for the multi-file version)
  • output_filename (string): The name of the output zip file where the zipped files should be saved.

Returns

  • boolean: A boolean value indicating whether the zip operation succeeded (true) or failed (false).

Examples

js
var result = datasource.zip("myfile.txt", "output.zip");
if (result) {
    console.log("File zipped successfully.");
} else {
    console.log("File zipping failed.");
}
js
var result = datasource.zip(["file1.txt", "file2.txt"], "output.zip");
if (result) {
    console.log("Files zipped successfully.");
} else {
    console.log("Files zipping failed.");
}