{"name":"buffer-from","version":"1.1.2","license":"MIT","repository":{"type":"git","url":"git+https://github.com/LinusU/buffer-from.git"},"scripts":{"test":"standard && node test"},"devDependencies":{"standard":"^12.0.1"},"keywords":["buffer","buffer from"],"gitHead":"fa0c9264a1b7eddf8c1aa1bbd78ce0ac256c485f","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@1.1.2","_nodeVersion":"16.5.0","_npmVersion":"7.19.1","dist":{"integrity":"sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==","shasum":"2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5","tarball":"http://registry-npm.ywwl.com/buffer-from/download/buffer-from-1.1.2.tgz","fileCount":4,"unpackedSize":5047,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhAt/dCRA9TVsSAnZWagAAK3gP/3U4DZr6cDPvIUqEzn6Z\npqnUZD8mwnMtuFYU2LFuB1/biFBrLv0Mph2aXBh8k2nCjKoMuqy7AKGVkv7q\n1ieA/JAHWdEhDuo82I+Hi0qqzw9jpwp7l5mLFTdFX90HtA8BOvyWGDkdg3pL\nbFVP1dxBHu8LI3zrWnd2ruAYOoylSXNysJuXwaSqV6OToz/8ZRYrbyzZC/4m\noqxS6WdflQcs7jSLJkBZSHTV6rmCoDg3FbB5zLiJOUfj4oUM/JnlkN6cR54/\nhXVJo0s0+Rqb8KL7+tR3pj+sjJQqtzvPi21sMBbkg/btayJs9DUJSEp6h0/x\nfSgTBGVaPT5jbAM45e2KmkAI78eLlpwNUZzM34FFuYj8Zl1Fjnckdj7Fgadn\nJLpv283KG4oYY5yF16inPIaAh7hf74eNVx+KBjTs4jOt89CDFEmViANgV5+e\nLhS21CdMMkPIuA4xnB+Ya5jeC19Z03gKSN+t5vA2nFK2l0K7/JUMzF4jICUz\nr2q5kt3RiN2/EH3I4wYUnE6cuOKWmxF4IpB9rNU16ARV5Bxq4zp42JoDgGie\nbpaVM8YWvkMAj0eBXJ+pW5JSDdQnwpuiaPx9ry3ZfpYv9QkCWjr0qibSsXu+\n10CK9AbxTy+QRPNYkTn/te7WH2bc/V3l80ypNEnXJJICKWgOzgH4W4kG1fjH\nHMP0\r\n=2uut\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICwILuKQPZZQ6XxAN2DiGeVk/fpq0Ls5VaL1Sxgl4JGcAiAubelJ6nbraK71jpE/QRm7uePA3TtO4Yo/sXvSly8W7Q=="}],"size":2313,"noattachment":false,"key":"/buffer-from/-/buffer-from-1.1.2.tgz"},"_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"directories":{},"maintainers":[{"name":"linusu","email":"linus@folkdatorn.se"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/buffer-from_1.1.2_1627578332878_0.7445773613261815"},"_hasShrinkwrap":false,"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":1627578333074,"_cnpm_publish_time":1627578333074,"dist-tags":{"latest":"1.1.2"}}