mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 08:31:43 +03:00
7556e68c48
* 🎨 Ghost bootstrap: optimise requires
no issue
- require as less as possible on bootstrap
* do not load icojs on bootstrap
20 lines
500 B
JavaScript
20 lines
500 B
JavaScript
var fs = require('fs');
|
|
|
|
module.exports = function zipFolder(folderToZip, destination, callback) {
|
|
var archiver = require('archiver'),
|
|
output = fs.createWriteStream(destination),
|
|
archive = archiver.create('zip', {});
|
|
|
|
output.on('close', function () {
|
|
callback(null, archive.pointer());
|
|
});
|
|
|
|
archive.on('error', function (err) {
|
|
callback(err, null);
|
|
});
|
|
|
|
archive.directory(folderToZip, '/');
|
|
archive.pipe(output);
|
|
archive.finalize();
|
|
};
|