Program stays alive for a while after writing the zip file in Deno #516
-
I apologize if I'm misusing the library in some way- but when I use the code below, the file gets written quickly, but the program stays awake for a few seconds before closing. It doesn't happen when not writing the zip file or when writing something else, or if no file gets added to the zip archive. Do you know why this might be? import { BlobWriter, ZipWriter } from "@zip-js/zip-js";
const blobWriter = new BlobWriter();
const zipWriter = new ZipWriter(blobWriter);
await zipWriter.add(
"file.txt",
new Blob([new TextEncoder().encode("Hello, world!")]).stream()
);
await zipWriter.close();
Deno.writeFile("out.zip", (await blobWriter.getData()).stream()); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This is due to the fact that web workers stay alive 5 seconds (default value). You can terminate them after |
Beta Was this translation helpful? Give feedback.
This is due to the fact that web workers stay alive 5 seconds (default value). You can terminate them after
await zipWriter.close()
by callingawait terminateWorkers()
. Alternatively, you can also callconfigure({ terminateWorkerTimeout: 0 })
before callingawait zipWriter.add(...)
.