0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.128.168.219


Current Path : /proc/self/root/usr/share/doc/node-tar/examples/
Upload File :
Current File : //proc/self/root/usr/share/doc/node-tar/examples/packer.js

var tar = require("../tar.js")
  , fstream = require("fstream")
  , fs = require("fs")

var dirDest = fs.createWriteStream('dir.tar')


function onError(err) {
  console.error('An error occurred:', err)
}

function onEnd() {
  console.log('Packed!')
}

var packer = tar.Pack({ noProprietary: true })
  .on('error', onError)
  .on('end', onEnd);

// This must be a "directory"
fstream.Reader({ path: __dirname, type: "Directory" })
  .on('error', onError)
  .pipe(packer)
  .pipe(dirDest)