Skip to content

Commit

Permalink
Fall back to browser Reader when passing an Uint8Array under node, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Jan 2, 2017
1 parent a4e41b5 commit 0c03f32
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ Reader.create = util.Buffer
if (!BufferReader)
BufferReader = require("./reader_buffer");
return (Reader.create = function create_buffer(buffer) {
return new BufferReader(buffer);
return util.Buffer.isBuffer(buffer)
? new BufferReader(buffer)
: new Reader(buffer);
})(buffer);
}
/* istanbul ignore next */
Expand Down

0 comments on commit 0c03f32

Please sign in to comment.