Skip to content

Commit

Permalink
readme: explain browserify/Buffer behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
paulkernfeld authored and indutny committed Nov 16, 2016
1 parent e4a8213 commit ddcb2cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ either `le` (little-endian) or `be` (big-endian).
pad to length, throwing if already exceeding
* `a.toArrayLike(type, endian, length)` - convert to an instance of `type`,
which must behave like an `Array`
* `a.toBuffer(endian, length)` - convert to Node.js Buffer (if available)
* `a.toBuffer(endian, length)` - convert to Node.js Buffer (if available). For
compatibility with browserify and similar tools, use this instead:
`a.toArrayLike(Buffer, endian, length)`
* `a.bitLength()` - get number of bits occupied
* `a.zeroBits()` - return number of less-significant consequent zero bits
(example: `1010000` has 4 zero bits)
Expand Down
1 change: 1 addition & 0 deletions lib/bn.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

var Buffer;
try {
// Obfuscate that we require Buffer, to reduce size
Buffer = require('buf' + 'fer').Buffer;
} catch (e) {
}
Expand Down

0 comments on commit ddcb2cf

Please sign in to comment.