Skip to content

cla/zip - Local zip files management

These functions are for managing zip files located in the Clarive server instance filesystem.

zip.contents(file)

List contents of a zip file. It returns an array of { file, size, date } objects

var zip = require('cla/zip');
zip.contents("/tmp/myfile.zip");

zip.compress(file, contents, basepath, overwrite)

Adds files in the contents array to the zip archive specified in file cutting the contents paths from the basepath specified in the third parameter. If the zip file already exists, it will append/modify the contents unless you specified 1 in the forth parameter. In that case, it will create a new zip file.

var zip = require('cla/zip');
zip.compress("/tmp/myfile.zip",["/tmp/file1.txt","/tmp/file2.txt"],"/tmp");

zip.unCompress(file, path)

Uncompress archive file in the destination path

var zip = require('cla/zip');
zip.unCompress("/tmp/myfile.zip","/tmp/zipContents");