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

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.1.9 to 0.2.0

17

adm-zip.js

@@ -193,3 +193,11 @@ var fs = require("fs"),

if (fs.existsSync(localPath)) {
// do stuff
var entry = new ZipEntry();
entry.entryName = localPath.split("\\").join("/"); //windows fix
var stats = fs.statSync(localPath);
entry.setData(fs.readFileSync(localPath));
entry.header.inAttr = stats.mode;
entry.header.attr = stats.mode;
entry.attr = stats.mode;
entry.header.time = stats.mtime;
_zip.setEntry(entry);
} else {

@@ -237,3 +245,3 @@ throw Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath);

/**
* Allows you to programmatically create a entry (file or directory) in the zip file.
* Allows you to create a entry (file or directory) in the zip file.
* If you want to create a directory the entryName must end in / and a null buffer should be provided.

@@ -298,3 +306,3 @@ * Comment and attributes are optional

overwrite = overwrite || false;
maintainEntryPath = typeof maintainEntryPath == "undefned" ? true : maintainEntryPath;
maintainEntryPath = typeof maintainEntryPath == "undefined" ? true : maintainEntryPath;

@@ -362,3 +370,2 @@ var item = getEntry(entry);

writeZip : function(/*String*/targetFileName, /*Function*/callback) {
if (arguments.length == 1) {

@@ -402,2 +409,2 @@ if (typeof targetFileName == "function") {

}
};
};

@@ -1014,3 +1014,3 @@ function JSDeflater(/*inbuff*/inbuf) {

pages.push(buf);
totalSize += buff.length;
totalSize += buf.length;
}

@@ -1052,2 +1052,2 @@ var result = new Buffer(totalSize),

}
};
};
{
"name": "adm-zip",
"version": "0.1.9",
"version": "0.2.0",
"description": "A Javascript implementation of zip for nodejs. Allows user to create or extract zip files both in memory or to/from disk",

@@ -5,0 +5,0 @@ "keywords": [

@@ -24,3 +24,3 @@ var fs = require("fs"),

if (_path && pth.existsSync(_path)) {
if (_path && fs.existsSync(_path)) {
_stat = fs.statSync(_path);

@@ -85,2 +85,2 @@ _obj.directory = _stat.isDirectory();

};
};
var fs = require("fs"),
pth = require('path');
fs.existsSync = fs.existsSync || pth.existsSync;
module.exports = (function() {

@@ -80,3 +82,3 @@

case Constants.DEFLATED:
return 'DEFATED (' + method + ')';
return 'DEFLATED (' + method + ')';
default:

@@ -89,3 +91,3 @@ return 'UNSUPPORTED (' + method + ')'

writeFileTo : function(/*String*/path, /*Buffer*/content, /*Boolean*/overwrite, /*Number*/attr) {
if (pth.existsSync(path)) {
if (fs.existsSync(path)) {
if (!overwrite)

@@ -100,3 +102,3 @@ return false; // cannot overwite

var folder = pth.dirname(path);
if (!pth.existsSync(folder)) {
if (!fs.existsSync(folder)) {
mkdirSync(folder);

@@ -135,2 +137,2 @@ }

}
})();
})();

@@ -37,3 +37,4 @@ var ZipEntry = require("./zipEntry"),

// read data
entry.setCompressedData(buf.slice(entry.header.offset, entry.header.offset + Utils.Constants.LOCHDR + entry.header.compressedSize + entry.entryName.length));
//entry.setCompressedData(buf.slice(entry.header.offset, entry.header.offset + Utils.Constants.LOCHDR + entry.header.compressedSize + entry.entryName.length));
entry.setCompressedData(buf.slice(entry.header.offset, entry.header.offset + Utils.Constants.LOCHDR + entry.header.compressedSize + entry.entryName.length + buf.readUInt16LE(entry.header.offset + Utils.Constants.LOCEXT)));
}

@@ -40,0 +41,0 @@

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