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

yauzl-clone

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yauzl-clone - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

5

changelog.md

@@ -12,1 +12,6 @@ # Changelog

* README typo
# Next
* Fix: `.clone()` with `subclassZipFile` option breaks `lazyEntries: false` (closes #1)
* Remove unnecessary instanceof checks in patchers

49

lib/index.js

@@ -184,22 +184,44 @@ /* --------------------

return function(path, totalSize, options, callback) {
// Set `lazyEntries` option to prevent `._readEntry()` being called on
// internal zipFile object. Needs to be called on subclass instance instead.
const {lazyEntries} = options,
hasLazyEntries = options.hasOwnProperty('lazyEntries');
if (!lazyEntries) options.lazyEntries = true;
// Call original method
return original.call(this, path, totalSize, options, function(err, zipFile) {
if (err) return callback(err);
if (!(zipFile instanceof ZipFile)) {
const zipFileInternal = zipFile;
zipFile = Object.assign(Object.create(ZipFile.prototype), zipFile);
// Convert to instance of subclass
const zipFileInternal = zipFile;
zipFile = Object.assign(Object.create(ZipFile.prototype), zipFile);
// Remove event interceptors from internal ZipFile
// so `close` + `error` events fire on exposed zipFile instance
// NB `._interceptors` already copied to subclass instance above
if (zipFile._interceptors) zipFileInternal._interceptors = {};
// Remove event interceptors from internal ZipFile
// so `close` + `error` events fire on exposed zipFile instance
// NB `._interceptors` already copied to subclass instance above
if (zipFile._interceptors) zipFileInternal._interceptors = {};
// Do not inherit event handlers from superclass
if (zipFile._events == zipFileInternal._events) zipFile._events = {};
// Do not inherit event handlers from superclass
if (zipFile._events == zipFileInternal._events) zipFile._events = {};
// Forward events from internal ZipFile to exposed one
zipFileInternal.on('close', () => zipFile.emit('close'));
zipFileInternal.on('error', err => zipFile.emit('error', err));
// Forward events from internal ZipFile to exposed one
zipFileInternal.on('close', () => zipFile.emit('close'));
zipFileInternal.on('error', err => zipFile.emit('error', err));
// If lazyEntries option was modified, restore to previous setting
// and call `._readEntry()` on subclass instance
if (!lazyEntries) {
if (hasLazyEntries) {
options.lazyEntries = lazyEntries;
} else {
delete options.lazyEntries;
}
zipFile.lazyEntries = false;
zipFileInternal.lazyEntries = false;
zipFile._readEntry();
}
// Callback with subclass instance
callback(null, zipFile);

@@ -220,4 +242,3 @@ });

zipFile.intercept('entry', function(entry, cb) {
if (!(entry instanceof Entry)) entry = Object.assign(Object.create(Entry.prototype), entry);
entry = Object.assign(Object.create(Entry.prototype), entry);
cb(null, entry);

@@ -224,0 +245,0 @@ });

{
"name": "yauzl-clone",
"version": "1.0.1",
"version": "1.0.2",
"description": "Clone yauzl for patching",

@@ -5,0 +5,0 @@ "main": "./lib/",

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