extracter.js 385 B

12345678910111213141516171819
  1. var tar = require("../tar.js")
  2. , fs = require("fs")
  3. function onError(err) {
  4. console.error('An error occurred:', err)
  5. }
  6. function onEnd() {
  7. console.log('Extracted!')
  8. }
  9. var extractor = tar.Extract({path: __dirname + "/extract"})
  10. .on('error', onError)
  11. .on('end', onEnd);
  12. fs.createReadStream(__dirname + "/../test/fixtures/c.tar")
  13. .on('error', onError)
  14. .pipe(extractor);