-
-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
Consider the following code example when using the async API:
const zip = new StreamZip.async({file: 'unreadable.zip', storeEntries: true });
try {
await zip.entries();
} finally {
await zip.close();
}
When 'unreadable.zip' is not readable (e.g. a nearly empty text file), this code will leak a file handle to "unreadable.zip". This only happens with the promised-based API, not with the callback-based one.
The reason is found within the async close() method:
node-stream-zip/node_stream_zip.js
Line 748 in 7c5d503
| async close() { |
async close() {
const zip = await this[propZip];
...
zip.close();
}
The first line will already throw an exception if the zip file is completely unreadable. Therefore, zip.close() will never get called.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels