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

onezip

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onezip - npm Package Compare versions

Comparing version 4.1.0 to 4.2.0

lib/inhale.js

44

lib/onezip.js

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

const assert = require('assert');
const findit = require('findit2');
const pipe = require('pipe-io');

@@ -19,2 +17,4 @@ const tryToCatch = require('try-to-catch');

const superfind = require('./superfind');
inherits(OneZip, EventEmitter);

@@ -104,23 +104,17 @@

await Promise.all(promises);
};
OneZip.prototype._findFiles = promisify(function(filename, fn) {
const finder = findit(filename);
const inc = (name) => {
const filename = name.replace(String(this._from), '');
this._names.push(filename);
++this._n;
};
const all = Promise.all.bind(Promise, promises);
const [error] = await tryToCatch(all);
finder.on('file', inc);
finder.on('error', (error) => {
if (error) {
this.emit('error', error);
this.abort();
});
}
};
OneZip.prototype._findFiles = async function(filename) {
const {names} = await superfind(filename);
finder.on('directory', inc);
finder.on('link', inc);
finder.on('end', fn);
});
this._n = names.length;
this._names = names;
};

@@ -131,4 +125,4 @@ OneZip.prototype._pack = async function() {

const {
_to,
_from,
_to,
_names,

@@ -145,4 +139,4 @@ } = this;

for (const _name of _names) {
const filename = path.join(_from, _name);
const [error, data] = await tryToCatch(stat, filename);
const filename = _name.replace(_from, '');
const [error, data] = await tryToCatch(stat, _name);

@@ -153,3 +147,3 @@ if (error)

if (data.isDirectory()) {
zipfile.addEmptyDirectory(_name);
zipfile.addEmptyDirectory(filename);
end(_name);

@@ -159,7 +153,7 @@ continue;

const stream = this._createReadStream(filename, () => {
const stream = this._createReadStream(_name, () => {
end(_name);
});
zipfile.addReadStream(stream, _name);
zipfile.addReadStream(stream, filename);
}

@@ -166,0 +160,0 @@

{
"name": "onezip",
"version": "4.1.0",
"version": "4.2.0",
"description": "pack and extract .zip archives with emitter",

@@ -40,2 +40,3 @@ "type": "commonjs",

"@cloudcmd/stub": "^2.3.4",
"@iocmd/wait": "^1.0.0",
"coveralls": "^3.0.0",

@@ -42,0 +43,0 @@ "eslint": "^6.4.0",

Sorry, the diff of this file is not supported yet

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