{"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://registry-npm.ywwl.com/buffer-from/download/buffer-from-0.1.0.tgz","integrity":"sha512-VB11PczNxawoNdSfx9Wtp3e7u32ZvxtoTmBy3FBSF1AknhVjJIn6imh5IHn0/3jHGcjRxFDk9gkiemOtxfvKiQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHOTbZuHjJgi4b4Y0v7QTkDqdZRskrDXsVUjdV/wZ1oaAiAUhEup+ldUmX/NZ+OGfRLPiW2NuqmlsVpl/9S0Q5Qm2g=="}],"size":1430,"noattachment":false,"key":"/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":{},"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","publish_time":1471550044205,"_cnpm_publish_time":1471550044205,"dist-tags":{"latest":"1.1.2"}}