{"_id":"buffer-from","_rev":"382060","name":"buffer-from","description":"A [ponyfill](https://ponyfill.com) for `Buffer.from`, uses native implementation if available.","dist-tags":{"latest":"1.1.2"},"maintainers":[{"name":"linusu","email":""}],"time":{"modified":"2021-08-04T02:21:11.000Z","created":"2016-08-18T19:54:04.205Z","1.1.2":"2021-07-29T17:05:33.074Z","1.1.1":"2018-07-31T14:41:23.906Z","1.1.0":"2018-05-29T23:38:08.325Z","1.0.0":"2018-03-12T19:13:23.644Z","0.1.2":"2018-03-12T19:12:39.586Z","0.1.1":"2016-10-16T12:37:51.558Z","0.1.0":"2016-08-18T19:54:04.205Z"},"users":{},"repository":{"type":"git","url":"git+https://github.com/LinusU/buffer-from.git"},"versions":{"1.1.2":{"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":{"shasum":"2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5","size":2313,"noattachment":false,"key":"/buffer-from/-/buffer-from-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-from/download/buffer-from-1.1.2.tgz"},"_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"directories":{},"maintainers":[{"name":"linusu","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/buffer-from_1.1.2_1627578332878_0.7445773613261815"},"_hasShrinkwrap":false,"publish_time":1627578333074,"_cnpm_publish_time":1627578333074},"1.1.1":{"name":"buffer-from","version":"1.1.1","license":"MIT","repository":{"type":"git","url":"git+https://github.com/LinusU/buffer-from.git"},"files":["index.js"],"scripts":{"test":"standard && node test"},"devDependencies":{"standard":"^7.1.2"},"keywords":["buffer","buffer from"],"gitHead":"53f464194ae30e806f6faef635202b4dfd404ed5","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.1","_npmVersion":"6.1.0","_nodeVersion":"10.5.0","_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"dist":{"shasum":"32713bc028f75c02fdb710d7c7bcec1f2c6070ef","size":2292,"noattachment":false,"key":"/buffer-from/-/buffer-from-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-from/download/buffer-from-1.1.1.tgz"},"maintainers":[{"name":"linusu","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/buffer-from_1.1.1_1533048083841_0.2458068233892754"},"_hasShrinkwrap":false,"publish_time":1533048083906,"_cnpm_publish_time":1533048083906},"1.1.0":{"name":"buffer-from","version":"1.1.0","license":"MIT","repository":{"type":"git","url":"git+https://github.com/LinusU/buffer-from.git"},"files":["index.js"],"scripts":{"test":"standard && node test"},"devDependencies":{"standard":"^7.1.2"},"keywords":["buffer","buffer from"],"gitHead":"2bea5de4fdca7b13b5a9edafdcb1b74b9ffa6f98","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.0","_npmVersion":"5.6.0","_nodeVersion":"10.2.1","_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"dist":{"shasum":"87fcaa3a298358e0ade6e442cfce840740d1ad04","size":1627,"noattachment":false,"key":"/buffer-from/-/buffer-from-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-from/download/buffer-from-1.1.0.tgz"},"maintainers":[{"name":"linusu","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/buffer-from_1.1.0_1527637088129_0.03838545968741203"},"_hasShrinkwrap":false,"publish_time":1527637088325,"_cnpm_publish_time":1527637088325},"1.0.0":{"name":"buffer-from","version":"1.0.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":"645a803486f7aa17affe1b783f84f496789e28f9","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.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.7.1","_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"dist":{"shasum":"4cb8832d23612589b0406e9e2956c17f06fdf531","size":1728,"noattachment":false,"key":"/buffer-from/-/buffer-from-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-from/download/buffer-from-1.0.0.tgz"},"maintainers":[{"name":"linusu","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/buffer-from_1.0.0_1520882003570_0.3930838505714873"},"_hasShrinkwrap":false,"publish_time":1520882003644,"_cnpm_publish_time":1520882003644},"0.1.2":{"name":"buffer-from","version":"0.1.2","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":"4d65c51194eb8786218096d33a4613a091dbde5c","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.2","_npmVersion":"5.6.0","_nodeVersion":"9.7.1","_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"dist":{"shasum":"15f4b9bcef012044df31142c14333caf6e0260d0","size":1726,"noattachment":false,"key":"/buffer-from/-/buffer-from-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-from/download/buffer-from-0.1.2.tgz"},"maintainers":[{"name":"linusu","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/buffer-from_0.1.2_1520881959527_0.8321384344651832"},"_hasShrinkwrap":false,"publish_time":1520881959586,"_cnpm_publish_time":1520881959586},"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","size":1770,"noattachment":false,"key":"/buffer-from/-/buffer-from-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-from/download/buffer-from-0.1.1.tgz"},"maintainers":[{"name":"linusu","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/buffer-from-0.1.1.tgz_1476621469818_0.06613527098670602"},"directories":{},"publish_time":1476621471558,"_cnpm_publish_time":1476621471558,"_hasShrinkwrap":false},"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","size":1430,"noattachment":false,"key":"/buffer-from/-/buffer-from-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/buffer-from/download/buffer-from-0.1.0.tgz"},"maintainers":[{"name":"linusu","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/buffer-from-0.1.0.tgz_1471550043197_0.43763306783512235"},"directories":{},"publish_time":1471550044205,"_cnpm_publish_time":1471550044205,"_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","_attachments":{},"homepage":"https://github.com/LinusU/buffer-from#readme","bugs":{"url":"https://github.com/LinusU/buffer-from/issues"},"license":"MIT"}