Skip to content

datasource.unzip

Unzips a zip file from the MODLR filesystem.

js
datasource.unzip(filename)

or

js
datasource.unzip(filename, destination_path)

Parameters

  • filename (string): The name of the zip file you want to unzip.
  • destination_path (string): The directory where the unzipped files should be saved. If not provided, files will be unzipped to the same directory as the zip file. (optional)

Returns

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

Examples

js
var result = datasource.unzip("myfile.zip");
if (result) {
    console.log("File unzipped successfully.");
} else {
    console.log("File unzipping failed.");
}
js
var result = datasource.unzip("myfile.zip", "destination_directory/");
if (result) {
    console.log("File unzipped successfully to the specified directory.");
} else {
    console.log("File unzipping failed.");
}