New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gulp-zip

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-zip - npm Package Compare versions

Comparing version 3.2.0 to 4.0.0

54

index.js
'use strict';
var path = require('path');
var gutil = require('gulp-util');
var through = require('through2');
var chalk = require('chalk');
var Yazl = require('yazl');
var concatStream = require('concat-stream');
const path = require('path');
const gutil = require('gulp-util');
const through = require('through2');
const Yazl = require('yazl');
const getStream = require('get-stream');
module.exports = function (filename, opts) {
module.exports = (filename, opts) => {
if (!filename) {
throw new gutil.PluginError('gulp-zip', chalk.blue('filename') + ' required');
throw new gutil.PluginError('gulp-zip', '`filename` required');
}
opts = opts || {};
opts.compress = typeof opts.compress === 'boolean' ? opts.compress : true;
opts = Object.assign({
compress: true
}, opts);
var firstFile;
var zip = new Yazl.ZipFile();
let firstFile;
const zip = new Yazl.ZipFile();
return through.obj(function (file, enc, cb) {
return through.obj((file, enc, cb) => {
if (!firstFile) {

@@ -25,4 +25,4 @@ firstFile = file;

// because Windows...
var pathname = file.relative.replace(/\\/g, '/');
// Because Windows...
const pathname = file.relative.replace(/\\/g, '/');

@@ -40,3 +40,3 @@ if (!pathname) {

} else {
var stat = {
const stat = {
compress: opts.compress,

@@ -63,15 +63,15 @@ mtime: file.stat ? file.stat.mtime : new Date(),

zip.end(function () {
zip.outputStream.pipe(concatStream(function (data) {
this.push(new gutil.File({
cwd: firstFile.cwd,
base: firstFile.base,
path: path.join(firstFile.base, filename),
contents: data
}));
getStream.buffer(zip.outputStream).then(data => {
this.push(new gutil.File({
cwd: firstFile.cwd,
base: firstFile.base,
path: path.join(firstFile.base, filename),
contents: data
}));
cb();
}.bind(this)));
}.bind(this));
cb(); // eslint-disable-line promise/no-callback-in-promise
});
zip.end();
});
};
{
"name": "gulp-zip",
"version": "3.2.0",
"version": "4.0.0",
"description": "ZIP compress files",

@@ -10,9 +10,9 @@ "license": "MIT",

"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
"node": ">=4"
},
"scripts": {
"test": "mocha"
"test": "xo && ava"
},

@@ -32,4 +32,3 @@ "files": [

"dependencies": {
"chalk": "^1.0.0",
"concat-stream": "^1.4.7",
"get-stream": "^3.0.0",
"gulp-util": "^3.0.0",

@@ -40,8 +39,9 @@ "through2": "^2.0.1",

"devDependencies": {
"decompress-unzip": "*",
"gulp": "*",
"mocha": "*",
"vinyl-assign": "*",
"vinyl-file": "^2.0.0"
"ava": "*",
"decompress-unzip": "^3.0.0",
"gulp": "^3.9.1",
"vinyl-assign": "^1.2.1",
"vinyl-file": "^3.0.0",
"xo": "*"
}
}

@@ -19,7 +19,7 @@ # gulp-zip [![Build Status](https://travis-ci.org/sindresorhus/gulp-zip.svg?branch=master)](https://travis-ci.org/sindresorhus/gulp-zip)

gulp.task('default', () => {
return gulp.src('src/*')
gulp.task('default', () =>
gulp.src('src/*')
.pipe(zip('archive.zip'))
.pipe(gulp.dest('dist'));
});
.pipe(gulp.dest('dist'))
);
```

@@ -32,3 +32,3 @@

### zip(filename, options)
### zip(filename, [options])

@@ -41,2 +41,4 @@ #### filename

Type: `Object`
##### compress

@@ -50,2 +52,2 @@

MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc