summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/node_modules/tar/examples/extracter.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/node_modules/tar/examples/extracter.js')
-rw-r--r--deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/node_modules/tar/examples/extracter.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/node_modules/tar/examples/extracter.js b/deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/node_modules/tar/examples/extracter.js
new file mode 100644
index 0000000000..f6253a72c5
--- /dev/null
+++ b/deps/npm/node_modules/npm-lifecycle/node_modules/node-gyp/node_modules/tar/examples/extracter.js
@@ -0,0 +1,19 @@
+var tar = require("../tar.js")
+ , fs = require("fs")
+
+
+function onError(err) {
+ console.error('An error occurred:', err)
+}
+
+function onEnd() {
+ console.log('Extracted!')
+}
+
+var extractor = tar.Extract({path: __dirname + "/extract"})
+ .on('error', onError)
+ .on('end', onEnd);
+
+fs.createReadStream(__dirname + "/../test/fixtures/c.tar")
+ .on('error', onError)
+ .pipe(extractor);