Initial commit
[yaffs-website] / node_modules / tar / examples / extracter.js
1 var tar = require("../tar.js")
2   , fs = require("fs")
3
4
5 function onError(err) {
6   console.error('An error occurred:', err)
7 }
8
9 function onEnd() {
10   console.log('Extracted!')
11 }
12
13 var extractor = tar.Extract({path: __dirname + "/extract"})
14   .on('error', onError)
15   .on('end', onEnd);
16
17 fs.createReadStream(__dirname + "/../test/fixtures/c.tar")
18   .on('error', onError)
19   .pipe(extractor);