We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when I want to await the archive.finalize() and exit my program, my zip file would be broken when unzipping it.
here is my case
my node version is v14.17.4
please tell me if i used it in a wrong way
The text was updated successfully, but these errors were encountered:
core code here
import archiver from 'archiver'; import fs from 'fs'; async function zip(from: string, to: string,): Promise<void> { const ZIP_LEVEL = 9; const archive = archiver('zip', { zlib: { level: ZIP_LEVEL } }); const stream = fs.createWriteStream(to); archive .directory(from, false) .on('error', err => { throw err; }) .pipe(stream); await archive.finalize(); } async function main(){ await zip('./test','out.zip'); process.exit(); } main();
Sorry, something went wrong.
Try resolve your promise only after the stream has closed, like this example: #494 (comment)
thx~
No branches or pull requests
Discovered a likely bug.
when I want to await the archive.finalize() and exit my program, my zip file would be broken when unzipping it.
here is my case
my node version is v14.17.4
please tell me if i used it in a wrong way
The text was updated successfully, but these errors were encountered: