package.json 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. {
  2. "name": "buffer",
  3. "description": "Node.js Buffer API, for the browser",
  4. "version": "2.1.13",
  5. "author": {
  6. "name": "Feross Aboukhadijeh",
  7. "email": "feross@feross.org",
  8. "url": "http://feross.org"
  9. },
  10. "bugs": {
  11. "url": "https://github.com/feross/buffer/issues"
  12. },
  13. "contributors": [
  14. {
  15. "name": "Romain Beauxis",
  16. "email": "toots@rastageeks.org"
  17. },
  18. {
  19. "name": "James Halliday",
  20. "email": "mail@substack.net"
  21. }
  22. ],
  23. "dependencies": {
  24. "base64-js": "~0.0.4",
  25. "ieee754": "~1.1.1"
  26. },
  27. "devDependencies": {
  28. "benchmark": "1.x",
  29. "browserify": "3.x",
  30. "tape": "2.x"
  31. },
  32. "homepage": "http://feross.org",
  33. "keywords": [
  34. "buffer",
  35. "browserify",
  36. "compatible",
  37. "browser",
  38. "arraybuffer",
  39. "uint8array",
  40. "dataview"
  41. ],
  42. "license": "MIT",
  43. "main": "index.js",
  44. "repository": {
  45. "type": "git",
  46. "url": "git://github.com/feross/buffer.git"
  47. },
  48. "scripts": {
  49. "test": "tape test/*.js",
  50. "prepublish": "./bundle.sh",
  51. "perf": "cd perf/solo && browserify --debug readUInt32BE.js > bundle.js && open index.html",
  52. "size": "browserify -r ./ | uglifyjs -c -m | gzip | wc -c"
  53. },
  54. "testling": {
  55. "files": "test/*.js",
  56. "browsers": [
  57. "ie/6..latest",
  58. "chrome/4..latest",
  59. "firefox/3..latest",
  60. "safari/5.1..latest",
  61. "opera/12.0..latest",
  62. "iphone/6",
  63. "ipad/6",
  64. "android-browser/latest"
  65. ]
  66. },
  67. "readme": "# buffer [![build](https://img.shields.io/travis/feross/buffer.svg)](https://travis-ci.org/feross/buffer) [![npm](https://img.shields.io/npm/v/buffer.svg)](https://npmjs.org/package/buffer) [![npm downloads](https://img.shields.io/npm/dm/buffer.svg)](https://npmjs.org/package/buffer) [![gittip](https://img.shields.io/gittip/feross.svg)](https://www.gittip.com/feross/)\n\n#### The buffer module from [node.js](http://nodejs.org/), for the browser.\n\n[![testling badge](https://ci.testling.com/feross/buffer.png)](https://ci.testling.com/feross/buffer)\n\nWhen you `require('buffer')` or use the `Buffer` global in [browserify](http://github.com/substack/node-browserify), this module will automatically load.\n\nThe goal is to provide a Buffer API that is 100% identical to node's Buffer API. Read\nthe [official node.js docs](http://nodejs.org/api/buffer.html) for a full list of\nsupported methods.\n\n## features\n\n- Backed by Typed Arrays (`Uint8Array` and `ArrayBuffer`) (not `Object`, so it's fast)\n- Extremely small bundle size (**5.04KB minified + gzipped**, 35.5KB with comments)\n- Excellent browser support (IE 6+, Chrome 4+, Firefox 3+, Safari 5.1+, Opera 11+, iOS, etc.)\n- Preserves Node API exactly, with one important difference (see below)\n- Faster pretty much across the board (see perf results below)\n- `.slice()` returns instances of the same type (Buffer)\n- Square-bracket `buf[4]` notation works, even in old browsers like IE6!\n- Does not modify any browser prototypes or put anything on `window`.\n- Comprehensive test suite.\n\n\n## install\n\nIf you want to use this module directly without browserify, install it:\n\n```bash\nnpm install buffer\n```\n\nThis module was previously called **native-buffer-browserify**, but please use **buffer**\nfrom now on.\n\n\n## usage\n\nAs mentioned before, when you `require('buffer')` or use the `Buffer` global in [browserify](http://github.com/substack/node-browserify), this module will automatically\nbe included in your bundle so you get a `Buffer` API that actually works in the browser.\n\nIf you're depending on this module explicitly, then require it like this:\n\n```js\nvar Buffer = require('buffer/').Buffer // use the npm module, not the core module!\n```\n\nThe module's API is 100% identical to node's `Buffer` API. Read the\n[official docs](http://nodejs.org/api/buffer.html) for the full list of properties,\ninstance methods, and class methods supported by `Buffer`.\n\n\n## how does it work?\n\nThe `Buffer` constructor returns instances of `Uint8Array` that are augmented with function properties for all the `Buffer` API functions. We use `Uint8Array` so that square bracket notation works as expected -- it returns a single octet. By augmenting the instances, we can avoid modifying the `Uint8Array` prototype.\n\n\n## differences\n\n#### IMPORTANT: always use `Buffer.isBuffer` instead of `instanceof Buffer`\n\nThe Buffer constructor returns a `Uint8Array` (with all the Buffer methods added as\nproperties on the instance) for performance reasons, so `instanceof Buffer` won't work. In\nnode, you can use either `Buffer.isBuffer` or `instanceof Buffer` to check if an object\nis a `Buffer`. But, in the browser you must use `Buffer.isBuffer` to detect the special\n`Uint8Array`-based Buffers.\n\n#### Minor: `buf.slice()` does not modify parent buffer's memory in all browsers\n\nIf you only support modern browsers (specifically, those with typed array support), then\nthis issue does not affect you.\n\nIn node, the `slice()` method returns a new `Buffer` that shares underlying memory with\nthe original Buffer. When you modify one buffer, you modify the other. [Read more.](http://nodejs.org/api/buffer.html#buffer_buf_slice_start_end)\n\nThis works correctly in browsers with typed array support (\\* with the exception of Firefox older than version 30). Browsers that lack typed arrays get an alternate buffer implementation based on `Object` which has no mechanism to point separate `Buffer`s to the same underlying slab of memory.\n\n\\* *Firefox older than version 30 gets the `Object` implementation -- not the typed arrays one -- because of [this\nbug](https://bugzilla.mozilla.org/show_bug.cgi?id=952403) that made it impossible to add properties to a typed array.*\n\n\n## performance\n\nSee perf tests in `/perf`.\n\n```\n# Chrome 33\n\nNewBuffer#bracket-notation x 11,194,815 ops/sec ±1.73% (64 runs sampled)\nOldBuffer#bracket-notation x 9,546,694 ops/sec ±0.76% (67 runs sampled)\nFastest is NewBuffer#bracket-notation\n\nNewBuffer#concat x 949,714 ops/sec ±2.48% (63 runs sampled)\nOldBuffer#concat x 634,906 ops/sec ±0.42% (68 runs sampled)\nFastest is NewBuffer#concat\n\nNewBuffer#copy x 15,436,458 ops/sec ±1.74% (67 runs sampled)\nOldBuffer#copy x 3,990,346 ops/sec ±0.42% (68 runs sampled)\nFastest is NewBuffer#copy\n\nNewBuffer#readDoubleBE x 1,132,954 ops/sec ±2.36% (65 runs sampled)\nOldBuffer#readDoubleBE x 846,337 ops/sec ±0.58% (68 runs sampled)\nFastest is NewBuffer#readDoubleBE\n\nNewBuffer#new x 1,419,300 ops/sec ±3.50% (66 runs sampled)\nUint8Array#new x 3,898,573 ops/sec ±0.88% (67 runs sampled) (used internally by NewBuffer)\nOldBuffer#new x 2,284,568 ops/sec ±0.57% (67 runs sampled)\nFastest is Uint8Array#new\n\nNewBuffer#readFloatBE x 1,203,763 ops/sec ±1.81% (68 runs sampled)\nOldBuffer#readFloatBE x 954,923 ops/sec ±0.66% (70 runs sampled)\nFastest is NewBuffer#readFloatBE\n\nNewBuffer#readUInt32LE x 750,341 ops/sec ±1.70% (66 runs sampled)\nOldBuffer#readUInt32LE x 1,408,478 ops/sec ±0.60% (68 runs sampled)\nFastest is OldBuffer#readUInt32LE\n\nNewBuffer#slice x 1,802,870 ops/sec ±1.87% (64 runs sampled)\nOldBuffer#slice x 1,725,928 ops/sec ±0.74% (68 runs sampled)\nFastest is NewBuffer#slice\n\nNewBuffer#writeFloatBE x 830,407 ops/sec ±3.09% (66 runs sampled)\nOldBuffer#writeFloatBE x 508,446 ops/sec ±0.49% (69 runs sampled)\nFastest is NewBuffer#writeFloatBE\n\n# Node 0.11\n\nNewBuffer#bracket-notation x 10,912,085 ops/sec ±0.89% (92 runs sampled)\nOldBuffer#bracket-notation x 9,051,638 ops/sec ±0.84% (92 runs sampled)\nBuffer#bracket-notation x 10,721,608 ops/sec ±0.63% (91 runs sampled)\nFastest is NewBuffer#bracket-notation\n\nNewBuffer#concat x 1,438,825 ops/sec ±1.80% (91 runs sampled)\nOldBuffer#concat x 888,614 ops/sec ±2.09% (93 runs sampled)\nBuffer#concat x 1,832,307 ops/sec ±1.20% (90 runs sampled)\nFastest is Buffer#concat\n\nNewBuffer#copy x 5,987,167 ops/sec ±0.85% (94 runs sampled)\nOldBuffer#copy x 3,892,165 ops/sec ±1.28% (93 runs sampled)\nBuffer#copy x 11,208,889 ops/sec ±0.76% (91 runs sampled)\nFastest is Buffer#copy\n\nNewBuffer#readDoubleBE x 1,057,233 ops/sec ±1.28% (88 runs sampled)\nOldBuffer#readDoubleBE x 4,094 ops/sec ±1.09% (86 runs sampled)\nBuffer#readDoubleBE x 1,587,308 ops/sec ±0.87% (84 runs sampled)\nFastest is Buffer#readDoubleBE\n\nNewBuffer#new x 739,791 ops/sec ±0.89% (89 runs sampled)\nUint8Array#new x 2,745,243 ops/sec ±0.95% (91 runs sampled)\nOldBuffer#new x 2,604,537 ops/sec ±0.93% (88 runs sampled)\nBuffer#new x 1,836,218 ops/sec ±0.74% (92 runs sampled)\nFastest is Uint8Array#new\n\nNewBuffer#readFloatBE x 1,111,263 ops/sec ±0.41% (97 runs sampled)\nOldBuffer#readFloatBE x 4,026 ops/sec ±1.24% (90 runs sampled)\nBuffer#readFloatBE x 1,611,800 ops/sec ±0.58% (96 runs sampled)\nFastest is Buffer#readFloatBE\n\nNewBuffer#readUInt32LE x 502,024 ops/sec ±0.59% (94 runs sampled)\nOldBuffer#readUInt32LE x 1,259,028 ops/sec ±0.79% (87 runs sampled)\nBuffer#readUInt32LE x 2,778,635 ops/sec ±0.46% (97 runs sampled)\nFastest is Buffer#readUInt32LE\n\nNewBuffer#slice x 1,174,908 ops/sec ±1.47% (89 runs sampled)\nOldBuffer#slice x 2,396,302 ops/sec ±4.36% (86 runs sampled)\nBuffer#slice x 2,994,029 ops/sec ±0.79% (89 runs sampled)\nFastest is Buffer#slice\n\nNewBuffer#writeFloatBE x 721,081 ops/sec ±1.10% (86 runs sampled)\nOldBuffer#writeFloatBE x 4,020 ops/sec ±1.04% (92 runs sampled)\nBuffer#writeFloatBE x 1,811,134 ops/sec ±0.67% (91 runs sampled)\nFastest is Buffer#writeFloatBE\n```\n\n\n## credit\n\nThis was originally forked from [buffer-browserify](https://github.com/toots/buffer-browserify).\n\n\n## license\n\nMIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org), and other contributors. Originally forked from an MIT-licensed module by Romain Beauxis.\n",
  68. "readmeFilename": "README.md",
  69. "_id": "buffer@2.1.13",
  70. "dist": {
  71. "shasum": "61aaffa2b8684074a9b7565f0e341375f11445a9"
  72. },
  73. "_from": "buffer@",
  74. "_resolved": "https://registry.npmjs.org/buffer/-/buffer-2.1.13.tgz"
  75. }