A node wrapper for p7zip including the latest version of 7za.
Because p7zip is a portage of 7-zip for linux systems, this package is not usable on Windows.
During the installation process, the latest version of p7zip is compiled to be used. This module handle both callback and promise syntax.
npm install --save p7zip
var p7zip = require('p7zip');
p7zip
.add('test.7z', '*.js')
.then(function (count) {
console.log('File added: ', count);
})
.then(function () {
return p7zip.list('test.7z');
})
.then(function (data) {
console.log('Path: ', data.path);
console.log('Type: ', data.type);
console.log('Method: ', data.method);
data.files.forEach(function (file, index) {
console.log('\nFile #' + (index + 1));
console.log(file.name);
console.log(file.date);
});
})
.catch(function (err) {
console.log(err);
});
Promise library use node Promise, but may be replaced:
var p7zip = require('p7zip');
p7zip.Promise = require('bluebird');
Arguments
archiveThe archive path.filesThe file list to add (string or array of string).switchesSwitches (string or array of string).
Returns
countThe file count added.
Arguments
archiveThe archive path.filesThe file list to delete (string or array of string).switchesSwitches (string or array of string).
Returns
- none
Default overwrite mode is set to "Overwrite All existing files without prompt" using switch -aoa.
Arguments
archiveThe archive path.destinationThe extraction path (optional).fileFilterFile filters to extract (string or array of string, optional).switchesSwitches (string or array of string).fullExtract with full paths (optional, default=true).
Returns
- none
Arguments
archiveThe archive path.switchesSwitches (string or array of string).
Returns
-
dataobject -
data.pathstring -
data.typestring -
data.physicalSizenumber -
data.headersSizenumber -
data.methodstring -
data.solidstring -
data.blocksnumber -
data.directoriesarray (same asdata.files) -
data.filesarray -
data.files[].attrstring -
data.files[].compressednumber -
data.files[].datedate -
data.files[].namenumber -
data.files[].sizenumber
Arguments
archiveThe archive path.filesHashmap of the file list to rename ({oldName: newName, ...}.switchesSwitches (string or array of string).
Returns
- none
Arguments
archivePath to the archive.filesThe file list to update (string or array of string).switchesSwitches (string or array of string).
Returns
countThe file count updated.