Skip to content

Commit

Permalink
Allow node.js Buffers in browser, since browserify provides them auto…
Browse files Browse the repository at this point in the history
…matically. Fixes #139
  • Loading branch information
humphd committed Jun 7, 2014
1 parent c2b5aea commit ad3f356
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 4 additions & 2 deletions lib/support.js
Expand Up @@ -3,8 +3,10 @@ exports.base64 = true;
exports.array = true;
exports.string = true;
exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined";
// contains true if JSZip can read/generate nodejs Buffer, false otherwise, aka checks if we arn't in a browser.
exports.nodebuffer = !process.browser;
// contains true if JSZip can read/generate nodejs Buffer, false otherwise.
// Browserify will provide a Buffer implementation for browsers, which is
// an augmented Uint8Array (i.e., can be used as either Buffer or U8).
exports.nodebuffer = typeof Buffer !== "undefined";
// contains true if JSZip can read/generate Uint8Array, false otherwise.
exports.uint8array = typeof Uint8Array !== "undefined";

Expand Down
4 changes: 0 additions & 4 deletions package.json
Expand Up @@ -9,10 +9,6 @@
"test-browser": "grunt build && grunt test",
"lint": "grunt jshint"
},
"browser": {
"./nodeBuffer": false,
"./nodeBufferReader": false
},
"contributors": [
{
"name": "Franz Buchinger"
Expand Down

0 comments on commit ad3f356

Please sign in to comment.