Socket
Socket
Sign inDemoInstall

adm-zip

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adm-zip - npm Package Compare versions

Comparing version 0.5.9 to 0.5.10

47

adm-zip.js

@@ -269,4 +269,5 @@ const Utils = require("./util");

* be included.
* @param {number | object} attr - number as unix file permissions, object as filesystem Stats object
*/
addLocalFolder: function (/**String*/ localPath, /**String=*/ zipPath, /**=RegExp|Function*/ filter) {
addLocalFolder: function (/**String*/ localPath, /**String=*/ zipPath, /**=RegExp|Function*/ filter, /**=number|object*/ attr) {
// Prepare filter

@@ -303,5 +304,5 @@ if (filter instanceof RegExp) {

if (stats.isFile()) {
self.addFile(zipPath + p, filetools.fs.readFileSync(filepath), "", stats);
self.addFile(zipPath + p, filetools.fs.readFileSync(filepath), "", attr ? attr : stats);
} else {
self.addFile(zipPath + p + "/", Buffer.alloc(0), "", stats);
self.addFile(zipPath + p + "/", Buffer.alloc(0), "", attr ? attr : stats);
}

@@ -380,3 +381,5 @@ }

} else {
next();
process.nextTick(() => {
next();
});
}

@@ -447,20 +450,18 @@ } else {

// extended attributes field for Unix
if (!Utils.isWin) {
// set file type either S_IFDIR / S_IFREG
let unix = entry.isDirectory ? 0x4000 : 0x8000;
// set file type either S_IFDIR / S_IFREG
let unix = entry.isDirectory ? 0x4000 : 0x8000;
if (isStat) {
// File attributes from file stats
unix |= 0xfff & attr.mode;
} else if ("number" === typeof attr) {
// attr from given attr values
unix |= 0xfff & attr;
} else {
// Default values:
unix |= entry.isDirectory ? 0o755 : 0o644; // permissions (drwxr-xr-x) or (-r-wr--r--)
}
fileattr = (fileattr | (unix << 16)) >>> 0; // add attributes
if (isStat) {
// File attributes from file stats
unix |= 0xfff & attr.mode;
} else if ("number" === typeof attr) {
// attr from given attr values
unix |= 0xfff & attr;
} else {
// Default values:
unix |= entry.isDirectory ? 0o755 : 0o644; // permissions (drwxr-xr-x) or (-r-wr--r--)
}
fileattr = (fileattr | (unix << 16)) >>> 0; // add attributes
entry.attr = fileattr;

@@ -640,8 +641,10 @@

extractAllToAsync: function (/**String*/ targetPath, /**Boolean*/ overwrite, /**Boolean*/ keepOriginalPermission, /**Function*/ callback) {
if (!callback) {
callback = function () {};
}
overwrite = get_Bool(overwrite, false);
if (typeof keepOriginalPermission === "function" && !callback) callback = keepOriginalPermission;
keepOriginalPermission = get_Bool(keepOriginalPermission, false);
if (!callback) {
callback = function (err) {
throw new Error(err);
};
}
if (!_zip) {

@@ -648,0 +651,0 @@ callback(new Error(Utils.Errors.NO_ZIP));

@@ -79,3 +79,3 @@ var Utils = require("../util"),

// central directory size in bytes
_size = Utils.readBigUInt64LE(data, Constants.ZIP64SIZ);
_size = Utils.readBigUInt64LE(data, Constants.ZIP64SIZE);
// offset of first CEN header

@@ -131,1 +131,2 @@ _offset = Utils.readBigUInt64LE(data, Constants.ZIP64OFF);

};
// Misspelled
{
"name": "adm-zip",
"version": "0.5.9",
"version": "0.5.10",
"description": "Javascript implementation of zip for nodejs with support for electron original-fs. Allows user to create or extract zip files both in memory or to/from disk",

@@ -44,3 +44,3 @@ "scripts": {

"chai": "^4.3.4",
"mocha": "^8.3.2",
"mocha": "^10.2.0",
"prettier": "^2.2.1",

@@ -47,0 +47,0 @@ "rimraf": "^3.0.2"

const fsystem = require("./fileSystem").require();
const pth = require("path");
const Constants = require("./constants");
const Errors = require("./errors");
const isWin = typeof process === "object" && "win32" === process.platform;

@@ -5,0 +6,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