First I wan't to say fantastic library. Works great and is very lightweight and doesn't require disk I/O which is great for AWS Lambda.
Just a suggestion but you might want to update the README.md example as I found it a bit confusing.
Because the pack.finalize() is nested within the pack.entry({}, function(err) {}` it was not entirely apparent that I needed to call it. I mistakenly thought it had to do with adding the entry via stream (2nd use case specific). It tripped me up for a while until I read through a closed issue that gave a more concrete example. It might help others avoid this confusion too if you updated the example like so...
// add a file called my-stream-test.txt from a streamvar entry = pack.entry({ name: 'my-stream-test.txt', size: 11 }, function(err) {// the stream was added// no more entries})
First I wan't to say fantastic library. Works great and is very lightweight and doesn't require disk I/O which is great for AWS Lambda.
Just a suggestion but you might want to update the README.md example as I found it a bit confusing.
Because the
pack.finalize()
is nested within thepack.entry({}, function(err) {
}` it was not entirely apparent that I needed to call it. I mistakenly thought it had to do with adding the entry via stream (2nd use case specific). It tripped me up for a while until I read through a closed issue that gave a more concrete example. It might help others avoid this confusion too if you updated the example like so...// add a file called my-stream-test.txt from a stream
var entry = pack.entry({ name: 'my-stream-test.txt', size: 11 }, function(err) {
// the stream was added
// no more entries
})
pack.finalize()
//MOVE outside ofpack.entry