Closed sidprice closed 5 years ago
.then
is for a promise api, which is not implemented in this library. You can create your own promise and call the 7z function in the constructor, and resolve it on the end
event and reject on the error
event.
new Promise((resolve, reject) => {
const files = []
const process = sevenZip.extractFull(devicePackFile, tempFolder.name, { $bin: pathTo7zip})
process.on('data', file => files.push(file))
process.on('end', () => resolve({ files }))
process.on('error', reject)
})
.then(etc) // now this works
Here's some code where I promisified the whole library and have it automatically pass $bin
for me.
https://github.com/m59peacemaker/extract-archive-without-blowing-up/blob/master/7z.js
Thanks for the update, I had already found this route and the library is working nicely, nice work.
I am using node-7z together with 7zip-bin to sequentially process some archive files in my Electron (node.js) application. The issue I have is that I get the above error when I try to run my code. I have searched for a solution but so far been unable to find one. The code in questions is:
I hope you can help me, thanks for this nice package.