aboutsummaryrefslogtreecommitdiff
path: root/node_modules/gulp-zip/index.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
commitcc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch)
tree92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/gulp-zip/index.js
parent3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff)
remove node_modules
Diffstat (limited to 'node_modules/gulp-zip/index.js')
-rw-r--r--node_modules/gulp-zip/index.js75
1 files changed, 0 insertions, 75 deletions
diff --git a/node_modules/gulp-zip/index.js b/node_modules/gulp-zip/index.js
deleted file mode 100644
index 52794e451..000000000
--- a/node_modules/gulp-zip/index.js
+++ /dev/null
@@ -1,75 +0,0 @@
-'use strict';
-const path = require('path');
-const Vinyl = require('vinyl');
-const PluginError = require('plugin-error');
-const through = require('through2');
-const Yazl = require('yazl');
-const getStream = require('get-stream');
-
-module.exports = (filename, opts) => {
- if (!filename) {
- throw new PluginError('gulp-zip', '`filename` required');
- }
-
- opts = Object.assign({
- compress: true
- }, opts);
-
- let firstFile;
- const zip = new Yazl.ZipFile();
-
- return through.obj((file, enc, cb) => {
- if (!firstFile) {
- firstFile = file;
- }
-
- // Because Windows...
- const pathname = file.relative.replace(/\\/g, '/');
-
- if (!pathname) {
- cb();
- return;
- }
-
- if (file.isNull() && file.stat && file.stat.isDirectory && file.stat.isDirectory()) {
- zip.addEmptyDirectory(pathname, {
- mtime: opts.modifiedTime || file.stat.mtime || new Date(),
- mode: file.stat.mode
- });
- } else {
- const stat = {
- compress: opts.compress,
- mtime: opts.modifiedTime || (file.stat ? file.stat.mtime : new Date()),
- mode: file.stat ? file.stat.mode : null
- };
-
- if (file.isStream()) {
- zip.addReadStream(file.contents, pathname, stat);
- }
-
- if (file.isBuffer()) {
- zip.addBuffer(file.contents, pathname, stat);
- }
- }
-
- cb();
- }, function (cb) {
- if (!firstFile) {
- cb();
- return;
- }
-
- getStream.buffer(zip.outputStream).then(data => {
- this.push(new Vinyl({
- cwd: firstFile.cwd,
- base: firstFile.base,
- path: path.join(firstFile.base, filename),
- contents: data
- }));
-
- cb();
- });
-
- zip.end();
- });
-};