mafintosh / tar-stream

tar-stream is a streaming tar parser and generator.
MIT License
406 stars 92 forks source link

Update README.md Example #102

Closed ryderjgillen closed 1 year ago

ryderjgillen commented 5 years ago

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 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 of pack.entry

mafintosh commented 4 years ago

Fair :) Can you send a PR?