nl_tokens: Create a Bzip2 compressed tar of a directory .
pl_tokens: function ( sourceDir , destFile , opts ) { opts = opts || { archive_path : '/' } ; return new Promise ( function ( resolve , reject ) { // pack var tempFile = destFile + '.tmp.tar' ; try { var archive = archiver . create ( 'tar' ) ; var output = fs . createWriteStream ( tempFile ) ; output . <mask> ( 'finish' , function ( ) { resolve ( tempFile ) ; } ) ; archive . pipe ( output ) ; archive . directory ( sourceDir , opts . archive_path ) ; archive . finalize ( ) ; } catch ( err ) { reject ( err ) ; } } ) . then ( function ( tempFile ) { // compress try { var data = new Buffer ( fs . readFileSync ( tempFile ) , 'utf8' ) ; var compressed = new Buffer ( Bzip2 . compressFile ( data ) ) ; fs . writeFileSync ( destFile , compressed ) ; return destFile ; } catch ( err ) { throw err ; } finally { rimraf . sync ( tempFile ) ; } } ) ; }