When I render a pass through the .render(response, callback) method, the callback only gets called when something fails.
I thing the issue is that the "end" event is never emitted when the zip file has been created successfully. I've done some testing, and I've seen that the "end" event on the zip variable is never fired neither.
When I add an zip.emit("end") after adding the signature is added to the zip. Still nothing happens. When i move the zip.on("end", ...) outside of the callback passed to the self.signZip(...) method, my original callback gets called.
here is how I changed the code:
in pass.js:
within the pipe function:
function doneWithImages() {
if (lastError) {
zip.close();
self.emit("error", lastError);
} else {
//This was moved up
zip.on("end", function() {
self.emit("end");
});
zip.on("error", function(error) {
self.emit("error", error);
});
//End of change
self.signZip(zip, manifest, function(error) {
zip.close();
//the above code was taken from here
});
}
}
within the signZip function:
signManifest(this.template, json, function(error, signature) {
if (!error) {
zip.addFile("signature").end(signature);
//The next line was added
zip.emit("end");
}
callback(error);
});
When I render a pass through the .render(response, callback) method, the callback only gets called when something fails.
I thing the issue is that the "end" event is never emitted when the zip file has been created successfully. I've done some testing, and I've seen that the "end" event on the zip variable is never fired neither.
When I add an zip.emit("end") after adding the signature is added to the zip. Still nothing happens. When i move the zip.on("end", ...) outside of the callback passed to the self.signZip(...) method, my original callback gets called.
here is how I changed the code:
in pass.js:
within the pipe function:
within the signZip function: