q2s2t / node-7z

A Node.js wrapper for 7-Zip
https://www.npmjs.org/package/node-7z
ISC License
178 stars 60 forks source link

Pause, resume and cancel extraction #114

Open Luury opened 2 years ago

Luury commented 2 years ago

Any way to pause and resume extraction? through a function or child_process "signal"...

const myStream = Seven.extractFull('./archive.7z', './output/dir/', {
  $progress: true
})

myStream.pause();

myStream.resume();

myStream.stop(); 

Could be an improvement...

richies-dev commented 1 year ago

I don't have a good answer for this but it's probably possible if you extract each file in the archive by name one at a time, and then for every file extracted save some flag like is_extracted or something. Then on pause stop extraction and on resume start extracting any files listed that do not have the flag is_extracted set.

Probably not the most performant method, and you would need a list of files/paths of everything in the archive, but it should work and is at least worth mentioning.