sandbox.js 371 B

1234567891011
  1. const tar = require('tar-stream')
  2. const fs = require('fs')
  3. const path = require('path')
  4. const pipeline = require('pump') // eequire('stream').pipeline
  5. fs.createReadStream('test.tar')
  6. .pipe(tar.extract())
  7. .on('entry', function (header, stream, done) {
  8. console.log(header.name)
  9. pipeline(stream, fs.createWriteStream(path.join('/tmp', header.name)), done)
  10. })