make example runnable
This commit is contained in:
parent
76ef6ddeea
commit
8a55714677
1 changed files with 5 additions and 2 deletions
|
@ -31,13 +31,16 @@ var pack = tar.pack() // pack is a streams2 stream
|
|||
pack.entry({ name: 'my-test.txt' }, 'Hello World!')
|
||||
|
||||
// add a file called my-stream-test.txt from a stream
|
||||
var entry = pack.entry({ name: 'my-stream-test.txt' }, function(err) {
|
||||
var entry = pack.entry({ name: 'my-stream-test.txt', size: 11 }, function(err) {
|
||||
// the stream was added
|
||||
// no more entries
|
||||
pack.finalize()
|
||||
})
|
||||
|
||||
someEntryStream.pipe(entry)
|
||||
entry.write('hello')
|
||||
entry.write(' ')
|
||||
entry.write('world')
|
||||
entry.end()
|
||||
|
||||
// pipe the pack stream somewhere
|
||||
pack.pipe(process.stdout)
|
||||
|
|
Loading…
Reference in a new issue