This module can create and extract zip files, both in memory and on disk.
This library is distributed under the MIT license, its source is www.npmjs.com/package/adm-zip For full documentation see https://github.com/cthackers/adm-zip/wiki
Executed
Server-side.
Details
var admzip = require('adm-zip');
The class constructor can have one or no arguments specified. If a argument of type String is provided, the class will try to read the file at 'filePath' and parse it as a zip. If no argument is specified, then a new in memory zip will be created
// loads and parses existing zip file local_file.zip
var zip = new admzip("local_file.zip");
// creates new in memory zip
var zip = new admzip();
See https://github.com/cthackers/adm-zip/wiki/ADM-ZIP for details of the methods that can be used.
Example
In this example a new zip is created in memory, a local folder added to it, the zip is written to disk, and an array of zip entry objects is returned.
function( params, credentials ) {
var AdmZip = require("adm-zip");
var zip = new AdmZip();
zip.addLocalFolder("E:/media/some-folder/folder");
zip.writeZip("E:/somewhere-new/mynewzip.zip");
var zipEntries = zip.getEntries();
return zipEntries;
}