- Square-bracket `buf[4]` notation works!
- Does not modify any browser prototypes.
- All tests from the original `buffer-browserify` project pass.
-- Works in browsers **without** `Uint8Array` support (IE9 and below)
+- Requires browsers to have `Uint8Array` support (IE9 and up)
## How does it work?
var assert
-if (typeof Uint8Array === 'function') {
- // Modern browser!
- exports.Buffer = Buffer
- exports.SlowBuffer = Buffer
- exports.INSPECT_MAX_BYTES = 50
- Buffer.poolSize = 8192
-} else {
- // Old browser :(
- module.exports = require('buffer-browserify')
-}
+exports.Buffer = Buffer
+exports.SlowBuffer = Buffer
+exports.INSPECT_MAX_BYTES = 50
+Buffer.poolSize = 8192
// TODO: throw the correct exception type on errors (look at node source)
"description": "buffer module compatibility for browserify (backed by ArrayBuffer so its fast!)",
"main": "index.js",
"dependencies": {
- "base64-js": "0.0.4",
- "buffer-browserify": "~0.2.2"
+ "base64-js": "0.0.4"
},
"devDependencies": {
"tape": "~2.1.0",
- "tap": "~0.4.4",
"benchmark": "~1.0.0",
"browserify": "~2.35.4"
},