-
Notifications
You must be signed in to change notification settings - Fork 229
Open
Description
The documentation for the Zip.append method states that it takes a callback function, however the callback function is never actually called.
Minimal example:
"use strict";
const archiver = require("archiver");
const Writable = require("stream").Writable;
const archive = archiver("zip", {
zlib: {
level: 9
}
});
archive.pipe(new Writable({
write(chunk, encoding, callback) {
console.log("Processing:", chunk);
callback();
}
}));
archive.append("abc", {
name: "abc.txt"
}, () => {
// Never logged.
console.log("Done.");
});
archive.finalize();
Looking at the source code, the append method in lib/plugins/zip.js
has a callback function, which seems to be provided by _moduleAppend in lib/core.js
, rather than by the user.
The desired use case was wrapping the archiver in a Node writable stream as the final step in a stream processing pipeline for exporting data, for which callbacks are a cleaner interface to manage backpressure than events.
tracycollins and HainPalaxo
Metadata
Metadata
Assignees
Labels
No labels