Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tar download #7

Open
juliangruber opened this issue Jun 16, 2016 · 1 comment
Open

add tar download #7

juliangruber opened this issue Jun 16, 2016 · 1 comment

Comments

@juliangruber
Copy link
Owner

GET /KEY.tar -> tar archive

@juliangruber
Copy link
Owner Author

var tar = require('tar-stream')
var pack = tar.pack() // pack is a streams2 stream 

// add a file called my-test.txt with the content "Hello World!" 
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', size: 11 }, function(err) {
  // the stream was added 
  // no more entries 
  pack.finalize()
})

entry.write('hello')
entry.write(' ')
entry.write('world')
entry.end()

// pipe the pack stream somewhere 
pack.pipe(process.stdout)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant