Skip to content

Commit 576f7c5

Browse files
authored
Merge pull request #153 from kadledav/master
Added support for electron original-fs
2 parents 17bf90c + 49b10de commit 576f7c5

File tree

8 files changed

+16
-10
lines changed

8 files changed

+16
-10
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# ADM-ZIP for NodeJS
1+
# ADM-ZIP for NodeJS with added support for electron original-fs
2+
3+
* see comit https://github.com/kadledav/adm-zip/commit/3902bb2639dc4a39f1a2e8566219e085ff12a9d0
24

35
ADM-ZIP is a pure JavaScript implementation for zip data compression for [NodeJS](http://nodejs.org/).
46

adm-zip.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
var fs = require("fs"),
1+
var Utils = require("./util");
2+
var fs = Utils.FileSystem.require(),
23
pth = require("path");
34

45
fs.existsSync = fs.existsSync || pth.existsSync;
56

67
var ZipEntry = require("./zipEntry"),
7-
ZipFile = require("./zipFile"),
8-
Utils = require("./util");
8+
ZipFile = require("./zipFile");
99

1010
var isWin = /^win/.test(process.platform);
1111

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"name": "adm-zip",
2+
"name": "adm-zip-electron",
33
"version": "0.4.7",
4-
"description": "A Javascript implementation of zip for nodejs. Allows user to create or extract zip files both in memory or to/from disk",
4+
"description": "Fork of a 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",
55
"keywords": [
66
"zip",
77
"methods",
88
"archive",
99
"unzip"
1010
],
11-
"homepage": "http://github.com/cthackers/adm-zip",
11+
"homepage": "https://github.com/kadledav/adm-zip",
1212
"author": "Nasca Iacob <[email protected]> (https://github.com/cthackers)",
1313
"bugs": {
1414
"email": "[email protected]",

util/fattr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var fs = require("fs"),
1+
var fs = require("./fileSystem").require(),
22
pth = require("path");
33

44
fs.existsSync = fs.existsSync || pth.existsSync;

util/fileSystem.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
exports.require = function() {
2+
return require(process.versions['electron'] ? "original-fs" : "fs");
3+
};

util/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = require("./utils");
2+
module.exports.FileSystem = require("./fileSystem");
23
module.exports.Constants = require("./constants");
34
module.exports.Errors = require("./errors");
45
module.exports.FileAttr = require("./fattr");

util/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var fs = require("fs"),
1+
var fs = require("./fileSystem").require(),
22
pth = require('path');
33

44
fs.existsSync = fs.existsSync || pth.existsSync;

zipFile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = function(/*String|Buffer*/input, /*Number*/inputType) {
77
entryTable = {},
88
_comment = new Buffer(0),
99
filename = "",
10-
fs = require("fs"),
10+
fs = Utils.FileSystem.require(),
1111
inBuffer = null,
1212
mainHeader = new Headers.MainHeader();
1313

0 commit comments

Comments
 (0)