{"maintainers":[{"name":"linusu","email":"linus@folkdatorn.se"}],"keywords":["buffer","buffer from"],"dist-tags":{"latest":"0.1.1"},"description":"A [ponyfill](https://ponyfill.com) for `Buffer.from`, uses native implementation if available.","readme":"# Buffer From\n\nA [ponyfill](https://ponyfill.com) for `Buffer.from`, uses native implementation if available.\n\n## Installation\n\n```sh\nnpm install --save buffer-from\n```\n\n## Usage\n\n```js\nconst bufferFrom = require('buffer-from')\n\nconsole.log(bufferFrom([1, 2, 3, 4]))\n//=> <Buffer 01 02 03 04>\n\nconst arr = new Uint8Array([1, 2, 3, 4])\nconsole.log(bufferFrom(arr.buffer, 1, 2))\n//=> <Buffer 02 03>\n\nconsole.log(bufferFrom('test', 'utf8'))\n//=> <Buffer 74 65 73 74>\n\nconst buf = bufferFrom('test')\nconsole.log(bufferFrom(buf))\n//=> <Buffer 74 65 73 74>\n```\n\n## API\n\n### bufferFrom(array)\n\n- `array` &lt;Array&gt;\n\nAllocates a new `Buffer` using an `array` of octets.\n\n### bufferFrom(arrayBuffer[, byteOffset[, length]])\n\n- `arrayBuffer` &lt;ArrayBuffer&gt; The `.buffer` property of a TypedArray or ArrayBuffer\n- `byteOffset` &lt;Integer&gt; Where to start copying from `arrayBuffer`. **Default:** `0`\n- `length` &lt;Integer&gt; How many bytes to copy from `arrayBuffer`. **Default:** `arrayBuffer.length - byteOffset`\n\nWhen passed a reference to the `.buffer` property of a TypedArray instance, the\nnewly created `Buffer` will share the same allocated memory as the TypedArray.\n\nThe optional `byteOffset` and `length` arguments specify a memory range within\nthe `arrayBuffer` that will be shared by the `Buffer`.\n\n### bufferFrom(buffer)\n\n- `buffer` &lt;Buffer&gt; An existing `Buffer` to copy data from\n\nCopies the passed `buffer` data onto a new `Buffer` instance.\n\n### bufferFrom(string[, encoding])\n\n- `string` &lt;String&gt; A string to encode.\n- `encoding` &lt;String&gt; The encoding of `string`. **Default:** `'utf8'`\n\nCreates a new `Buffer` containing the given JavaScript string `string`. If\nprovided, the `encoding` parameter identifies the character encoding of\n`string`.\n\n## See also\n\n- [buffer-alloc](https://github.com/LinusU/buffer-alloc) A ponyfill for `Buffer.alloc`\n- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe`\n","repository":{"type":"git","url":"git+https://github.com/linusu/buffer-from.git"},"bugs":{"url":"https://github.com/linusu/buffer-from/issues"},"license":"MIT","versions":{"0.1.0":{"name":"buffer-from","version":"0.1.0","license":"MIT","repository":{"type":"git","url":"git+https://github.com/linusu/buffer-from.git"},"scripts":{"test":"standard && node test"},"devDependencies":{"standard":"^7.1.2"},"keywords":["buffer","buffer from"],"gitHead":"25cc13c38ea511a655495f990c4846a419f219c3","description":"A ponyfill for `Buffer.from`, uses native implementation if available.","bugs":{"url":"https://github.com/linusu/buffer-from/issues"},"homepage":"https://github.com/linusu/buffer-from#readme","_id":"buffer-from@0.1.0","_shasum":"a49dce54d048e955595d22e983ba5fe8aed5ffdd","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.1","_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"dist":{"shasum":"a49dce54d048e955595d22e983ba5fe8aed5ffdd","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/buffer-from/-/buffer-from-0.1.0.tgz"},"maintainers":[{"name":"linusu","email":"linus@folkdatorn.se"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/buffer-from-0.1.0.tgz_1471550043197_0.43763306783512235"},"directories":{}},"0.1.1":{"name":"buffer-from","version":"0.1.1","license":"MIT","repository":{"type":"git","url":"git+https://github.com/linusu/buffer-from.git"},"scripts":{"test":"standard && node test"},"devDependencies":{"standard":"^7.1.2"},"keywords":["buffer","buffer from"],"dependencies":{"is-array-buffer-x":"^1.0.13"},"gitHead":"07ff5440f58e6b279dac5e9007eed4f51cf84e92","description":"A [ponyfill](https://ponyfill.com) for `Buffer.from`, uses native implementation if available.","bugs":{"url":"https://github.com/linusu/buffer-from/issues"},"homepage":"https://github.com/linusu/buffer-from#readme","_id":"buffer-from@0.1.1","_shasum":"57b18b1da0a19ec06f33837a5275a242351bd75e","_from":".","_npmVersion":"2.15.1","_nodeVersion":"0.10.45","_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"dist":{"shasum":"57b18b1da0a19ec06f33837a5275a242351bd75e","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/buffer-from/-/buffer-from-0.1.1.tgz"},"maintainers":[{"name":"linusu","email":"linus@folkdatorn.se"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/buffer-from-0.1.1.tgz_1476621469818_0.06613527098670602"},"directories":{}}},"name":"buffer-from","time":{"modified":"2016-10-16T12:37:51.558Z","created":"2016-08-18T19:54:04.205Z","0.1.0":"2016-08-18T19:54:04.205Z","0.1.1":"2016-10-16T12:37:51.558Z"},"readmeFilename":"readme.md","homepage":"https://github.com/linusu/buffer-from#readme"}