Comparing version 0.4.14 to 0.4.16
@@ -22,3 +22,3 @@ var Utils = require("./util"); | ||
} else { | ||
throw Utils.Errors.INVALID_FILENAME; | ||
throw new Error(Utils.Errors.INVALID_FILENAME); | ||
} | ||
@@ -230,3 +230,3 @@ } else if (input && Buffer.isBuffer(input)) { // load buffer | ||
} else { | ||
throw Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath); | ||
throw new Error(Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath)); | ||
} | ||
@@ -277,3 +277,3 @@ }, | ||
items.forEach(function (path) { | ||
var p = path.split("\\").join("/").replace(new RegExp(localPath.replace(/(\(|\))/g, '\\$1'), 'i'), ""); //windows fix | ||
var p = path.split("\\").join("/").replace(new RegExp(localPath.replace(/(\(|\)|\$)/g, '\\$1'), 'i'), ""); //windows fix | ||
if (filter(p)) { | ||
@@ -289,3 +289,3 @@ if (p.charAt(p.length - 1) !== "/") { | ||
} else { | ||
throw Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath); | ||
throw new Error(Utils.Errors.FILE_NOT_FOUND.replace("%s", localPath)); | ||
} | ||
@@ -451,3 +451,3 @@ }, | ||
if (!item) { | ||
throw Utils.Errors.NO_ENTRY; | ||
throw new Error(Utils.Errors.NO_ENTRY); | ||
} | ||
@@ -466,3 +466,3 @@ | ||
if (!content) { | ||
throw Utils.Errors.CANT_EXTRACT_FILE; | ||
throw new Error(Utils.Errors.CANT_EXTRACT_FILE); | ||
} | ||
@@ -477,6 +477,6 @@ var childName = sanitize(targetPath, maintainEntryPath ? child.entryName : pth.basename(child.entryName)); | ||
var content = item.getData(); | ||
if (!content) throw Utils.Errors.CANT_EXTRACT_FILE; | ||
if (!content) throw new Error(Utils.Errors.CANT_EXTRACT_FILE); | ||
if (fs.existsSync(target) && !overwrite) { | ||
throw Utils.Errors.CANT_OVERRIDE; | ||
throw new Error(Utils.Errors.CANT_OVERRIDE); | ||
} | ||
@@ -523,3 +523,3 @@ Utils.writeFileTo(target, content, overwrite); | ||
if (!_zip) { | ||
throw Utils.Errors.NO_ZIP; | ||
throw new Error(Utils.Errors.NO_ZIP); | ||
} | ||
@@ -534,3 +534,3 @@ _zip.entries.forEach(function (entry) { | ||
if (!content) { | ||
throw Utils.Errors.CANT_EXTRACT_FILE; | ||
throw new Error(Utils.Errors.CANT_EXTRACT_FILE); | ||
} | ||
@@ -541,3 +541,3 @@ Utils.writeFileTo(entryName, content, overwrite); | ||
} catch (err) { | ||
throw Utils.Errors.CANT_EXTRACT_FILE; | ||
throw new Error(Utils.Errors.CANT_EXTRACT_FILE); | ||
} | ||
@@ -544,0 +544,0 @@ }) |
@@ -113,3 +113,3 @@ var Utils = require("../util"), | ||
if (data.readUInt32LE(0) !== Constants.LOCSIG) { | ||
throw Utils.Errors.INVALID_LOC; | ||
throw new Error(Utils.Errors.INVALID_LOC); | ||
} | ||
@@ -141,3 +141,3 @@ _dataHeader = { | ||
if (data.length !== Constants.CENHDR || data.readUInt32LE(0) !== Constants.CENSIG) { | ||
throw Utils.Errors.INVALID_CEN; | ||
throw new Error(Utils.Errors.INVALID_CEN); | ||
} | ||
@@ -144,0 +144,0 @@ // version made by |
@@ -38,3 +38,3 @@ var Utils = require("../util"), | ||
throw Utils.Errors.INVALID_END; | ||
throw new Error(Utils.Errors.INVALID_END); | ||
} | ||
@@ -41,0 +41,0 @@ |
{ | ||
"name": "adm-zip", | ||
"version": "0.4.14", | ||
"version": "0.4.16", | ||
"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", | ||
@@ -40,5 +40,5 @@ "scripts": { | ||
"chai": "^4.1.2", | ||
"mocha": "^5.2.0", | ||
"mocha": "^8.0.1", | ||
"rimraf": "^2.6.2" | ||
} | ||
} |
# ADM-ZIP for NodeJS with added support for electron original-fs | ||
ADM-ZIP is a pure JavaScript implementation for zip data compression for [NodeJS](http://nodejs.org/). | ||
ADM-ZIP is a pure JavaScript implementation for zip data compression for [NodeJS](https://nodejs.org/). | ||
# Installation | ||
With [npm](http://npmjs.org) do: | ||
With [npm](https://www.npmjs.com/) do: | ||
$ npm install adm-zip | ||
## What is it good for? | ||
@@ -65,2 +65,2 @@ The library allows you to: | ||
[![build status](https://secure.travis-ci.org/cthackers/adm-zip.png)](http://travis-ci.org/cthackers/adm-zip) | ||
[![Build Status](https://travis-ci.org/cthackers/adm-zip.svg?branch=master)](https://travis-ci.org/cthackers/adm-zip) |
@@ -64,3 +64,3 @@ var Utils = require("./util"), | ||
if (async && callback) callback(data, Utils.Errors.BAD_CRC);//si added error | ||
return Utils.Errors.BAD_CRC; | ||
throw new Error(Utils.Errors.BAD_CRC); | ||
} else {//si added otherwise did not seem to return data. | ||
@@ -76,3 +76,3 @@ if (async && callback) callback(data); | ||
if (!crc32OK(data)) { | ||
console.warn(Utils.Errors.BAD_CRC + " " + _entryName.toString()) | ||
throw new Error(Utils.Errors.BAD_CRC + " " + _entryName.toString()); | ||
} | ||
@@ -93,3 +93,3 @@ return data; | ||
if (async && callback) callback(Buffer.alloc(0), Utils.Errors.UNKNOWN_METHOD); | ||
return Utils.Errors.UNKNOWN_METHOD; | ||
throw new Error(Utils.Errors.UNKNOWN_METHOD); | ||
} | ||
@@ -96,0 +96,0 @@ } |
@@ -79,3 +79,3 @@ var ZipEntry = require("./zipEntry"), | ||
endOffset = -1, // Start offset of the END header | ||
commentEnd = 0; | ||
commentEnd = 0; | ||
@@ -108,3 +108,3 @@ for (i; i >= n; i--) { | ||
if (!~endOffset) | ||
throw Utils.Errors.INVALID_FORMAT; | ||
throw new Error(Utils.Errors.INVALID_FORMAT); | ||
@@ -309,3 +309,3 @@ mainHeader.loadFromBinary(inBuffer.slice(endOffset, endStart)); | ||
if (_comment) { | ||
_comment.copy(mh, Utils.Constants.ENDHDR); // add zip file comment | ||
Buffer.from(_comment).copy(mh, Utils.Constants.ENDHDR); // add zip file comment | ||
} | ||
@@ -312,0 +312,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79687