Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-vinyl-zip

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-vinyl-zip - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

43

lib/src/index.js

@@ -9,2 +9,3 @@ 'use strict';

var constants = require('constants');
var through = require('through2');

@@ -52,3 +53,3 @@ function modeFromEntry(entry) {

if (entry.uncompressedSize === 0) {
file.contents = new Buffer(0);
file.contents = Buffer.alloc(0);
result.emit('data', new File(file));

@@ -113,11 +114,2 @@

function unzipBuffer(contents) {
var result = es.through();
yauzl.fromBuffer(contents, function (err, zip) {
if (err) { return result.emit('error', err); }
toStream(zip).pipe(result);
});
return result;
}
function unzipFile(zipPath) {

@@ -133,22 +125,15 @@ var result = es.through();

function unzip() {
var input = es.through();
var result = es.through();
var zips = [];
var output = input.pipe(es.through(function (f) {
if (!f.isBuffer()) {
this.emit('error', new Error('Only supports buffers'));
}
zips.push(f);
}, function () {
var streams = zips.map(function (f) {
return unzipBuffer(f.contents);
return through.obj(function (file, enc, next) {
if (!file.isBuffer()) return next(new Error('Only supports buffers'));
yauzl.fromBuffer(file.contents, (err, zip) => {
if (err) {
this.emit('error', err)
} else {
toStream(zip)
.on('error', next)
.on('data', (data) => this.push(data))
.on('end', next)
}
});
es.merge(streams).pipe(result);
this.emit('end');
}));
return es.duplex(input, es.merge(output, result));
});
}

@@ -155,0 +140,0 @@

@@ -28,3 +28,3 @@ 'use strict';

if (stat.isSymbolicLink && stat.isSymbolicLink()) {
zip.addBuffer(new Buffer(file.symlink), path, opts);
zip.addBuffer(Buffer.from(file.symlink), path, opts);
} else if (file.isDirectory()) {

@@ -31,0 +31,0 @@ // In Windows, directories have a 666 permissions. This doesn't go well

{
"name": "gulp-vinyl-zip",
"version": "2.1.2",
"version": "2.1.3",
"description": "Streaming vinyl adapter for zip archives",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -41,2 +41,18 @@ 'use strict';

it('src should emit error to stream', function (done) {
var message;
vfs.src(__filename)
.pipe(lib.src())
.on('error', function (err) {
message = err.message;
this.emit('end');
})
.pipe(through.obj((file, enc, next) => next(null, file), function () { this.emit('end') }))
.on('end', () => {
assert.equal('end of central directory record signature not found', message);
done();
});
});
it('dest should be able to create an archive from another archive', function (cb) {

@@ -43,0 +59,0 @@ var dest = temp.openSync('gulp-vinyl-zip-test').path;

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