Skip to content

Commit ad3f356

Browse files
committed
Allow node.js Buffers in browser, since browserify provides them automatically. Fixes #139
1 parent c2b5aea commit ad3f356

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

lib/support.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ exports.base64 = true;
33
exports.array = true;
44
exports.string = true;
55
exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined";
6-
// contains true if JSZip can read/generate nodejs Buffer, false otherwise, aka checks if we arn't in a browser.
7-
exports.nodebuffer = !process.browser;
6+
// contains true if JSZip can read/generate nodejs Buffer, false otherwise.
7+
// Browserify will provide a Buffer implementation for browsers, which is
8+
// an augmented Uint8Array (i.e., can be used as either Buffer or U8).
9+
exports.nodebuffer = typeof Buffer !== "undefined";
810
// contains true if JSZip can read/generate Uint8Array, false otherwise.
911
exports.uint8array = typeof Uint8Array !== "undefined";
1012

package.json

-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
"test-browser": "grunt build && grunt test",
1010
"lint": "grunt jshint"
1111
},
12-
"browser": {
13-
"./nodeBuffer": false,
14-
"./nodeBufferReader": false
15-
},
1612
"contributors": [
1713
{
1814
"name": "Franz Buchinger"

0 commit comments

Comments
 (0)