-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,27 @@ var out = fs.createWriteStream('out.tar.gz'); | |
var gzipper = zlib.createGzip(); | ||
var archive = archiver.createTar(); | ||
|
||
archive.on('error', function(err) { | ||
console.log(err); | ||
}); | ||
|
||
archive.pipe(gzipper).pipe(out); | ||
|
||
archive.addFile(fs.createReadStream('file1.js'), {name: 'file1.js'}, function() { | ||
archive.addFile(fs.createReadStream('file2.js'), {name: 'file2.js'}, function() { | ||
archive.finalize(function(written) { | ||
archive.addFile(fs.createReadStream('file1.js'), {name: 'file1.js'}, function(err) { | ||
if (err) { | ||
throw err; | ||
} | ||
|
||
archive.addFile(fs.createReadStream('file2.js'), {name: 'file2.js'}, function(err) { | ||
if (err) { | ||
throw err; | ||
} | ||
|
||
archive.finalize(function(err, written) { | ||
if (err) { | ||
throw err; | ||
} | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
danmilon
Contributor
|
||
console.log(written + ' total bytes written'); // this wont be accurate since gzip happens after tar | ||
}); | ||
}); | ||
|
You can directly pass next.