Skip to content

Instantly share code, notes, and snippets.

@kylemanna
Created October 14, 2013 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylemanna/6983997 to your computer and use it in GitHub Desktop.
Save kylemanna/6983997 to your computer and use it in GitHub Desktop.
Example use of node-tar. that create a tarball of the "public" directory and writes it to out.tar.
// npm install tar fstream
var tar = require('tar');
var fstream = require('fstream');
var path = require('path');
var dst = fstream.Writer( { path: 'out.tar' } );
var src = fstream.Reader({ path: path.join(__dirname, './public'), type: "Directory" });
var pack = src.pipe(tar.Pack({ noProprietary: true }));
var out = pack.pipe(dst);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment