A nice addition to this package would be emitting events such as progress and entry so that implementers can see how far along they are with their decompression and to know what the currently decompressing or decompressed file is.
const zip = new Decompress()
.src(src)
.dest(dest)
.use(Decompress.zip())
.on('progress', pe => {
if (pe.lengthComputable) {
const percent = Math.round(pe.decompressed / pe.total * 100);
console.log(`${percent}% complete`);
}
})
.on('entry', entry => {
console.log(`Currently decompressing ${entry.fileName}.`);
})
.run();
A nice addition to this package would be emitting events such as
progress
andentry
so that implementers can see how far along they are with their decompression and to know what the currently decompressing or decompressed file is.The
progress
event data I modeled after the Web API standard: https://developer.mozilla.org/en-US/docs/Web/API/ProgressEvent and modifiedloaded
todecompressed
.The
entry
event data I modeled after information found in the zip specification on wikipedia.