{"name":"memcpy","version":"0.6.0","author":{"name":"Daniel Wirtz","email":"dcode@dcode.io"},"contributors":[{"name":"Denys Khanzhiyev","email":"xdenser@gmail.com"}],"description":"Copies data between node Buffers and/or ArrayBuffers up to ~75 times faster than in pure JS.","main":"src/memcpy.js","repository":{"type":"git","url":"git+https://github.com/dcodeIO/node-memcpy.git"},"bugs":{"url":"https://github.com/dcodeIO/node-memcpy/issues"},"keywords":["array","buffer","arraybuffer","typed array"],"dependencies":{"bindings":"~1.1","nan":"~1.2.0","node-arraybuffer":"^1.0.11"},"devDependencies":{"testjs":"latest"},"license":"Apache-2.0","engines":{"node":">=0.8 <=0.12"},"scripts":{"prepublish":"npm test","test":"node node_modules/testjs/bin/testjs tests/suite.js","make":"node-gyp configure build && npm test","install":"node-gyp configure build"},"gitHead":"5bd6b5fa536e14b88c735e0ce92c6aa11898cc0d","homepage":"https://github.com/dcodeIO/node-memcpy#readme","_id":"memcpy@0.6.0","_shasum":"e4fd93e47a9266d389bcc67cb2baafa2b44a46e6","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"dcode","email":"dcode@dcode.io"},"maintainers":[{"name":"dcode","email":"dcode@dcode.io"}],"dist":{"shasum":"e4fd93e47a9266d389bcc67cb2baafa2b44a46e6","tarball":"http://registry-npm.ywwl.com/memcpy/download/memcpy-0.6.0.tgz","integrity":"sha512-pddUAVPxmI5H2mxN8YbcEamgXHII3b5HaPNw1FeK1FObYYlgWIsS71DH0qrflGXRBx+B+gQAO3/anqsAu4Nv3A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFgncc6cFikIRy5Duyleon3Xet7NiaNE0nmBYPkNxIuHAiEA3+q+UF+Q87Yx6LS5sre7UPoISmXiHW7FjQNpr3B1+Vc="}],"size":8616,"noattachment":false,"key":"/memcpy/-/memcpy-0.6.0.tgz"},"directories":{},"readme":"node-memcpy\r\n===========\r\nCopies data between node Buffers and/or ArrayBuffers up to ~75 times faster than in pure JS.\r\n\r\nWait, what?\r\n-----------\r\nnode.js utilizes a non-standard concept of I/O buffers and thus has both its Buffer as well as ArrayBuffer support.\r\nWhile Buffers are nice because they are a lot faster than V8's ArrayBuffers, transferring data between those two\r\ntypes can be ridiculously slow. This is where a node module like memcpy comes into play.\r\n\r\n```\r\n// C++ binding\r\n\r\n i memcpy.100k > cc Buffer -> Buffer: 22.756ms\r\n i memcpy.100k > cc Buffer -> ArrayBuffer: 23.861ms\r\n\r\n i memcpy.100k > cc ArrayBuffer -> Buffer: 22.955ms\r\n i memcpy.100k > cc ArrayBuffer -> ArrayBuffer: 23.273ms\r\n\r\n// Native JS\r\n\r\n i memcpy.100k > js Buffer -> Buffer: 21.617ms\r\n i memcpy.100k > js Buffer -> ArrayBuffer: 993.361ms\r\n\r\n i memcpy.100k > js ArrayBuffer -> Buffer: 940.273ms\r\n i memcpy.100k > js ArrayBuffer -> ArrayBuffer: 1626.182ms\r\n```\r\n\r\nAPI\r\n---\r\n##### memcpy(target[, targetStart=0], source[, sourceStart=0[, sourceEnd=source.length]):bytesCopied\r\n\r\n| Argument     | Type                      | Optional  | Description\r\n|--------------|---------------------------|-----------|------------------------------------------------------------------\r\n| target       | Buffer &#124; ArrayBuffer |           | Target buffer to copy to\r\n| targetStart  | number                    | omittable | Target offset to begin copying to, defaults to `0`\r\n| source       | Buffer &#124; ArrayBuffer |           | Source buffer to copy from\r\n| sourceStart  | number                    | optional  | Source offset to begin copying from, defaults to `0`\r\n| sourceEnd    | number                    | optional  | Source offset to end copying from, defaults ot `source.length`\r\n| **@returns** | number                    |           | Number of bytes copied\r\n\r\nSource and target regions may overlap.\r\n\r\nUsage\r\n-----\r\n* `npm install memcpy`\r\n\r\n```js\r\nvar memcpy = require(\"memcpy\"), // C++ binding if available, else native JS\r\n    memcpy_binding = memcpy.binding, // C++ binding or NULL if not available\r\n    memcpy_native = memcpy.native; // Native JS\r\n...\r\n```\r\n\r\nPlease keep in mind that - besides the nice numbers - this is still to be considered experimental. I'd love if you'd\r\nreview the C++ code to validate that it's safe. I can't yet think of a sane use case, though, as just sticking with\r\nBuffers on node.js and ArrayBuffers in the browser should be best practice.\r\n\r\nContributors\r\n------------\r\n[Denys Khanzhiyev](https://github.com/xdenser) (node 0.11.13+ support with nan)\r\n\r\n**License:** [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)\r\n","publish_time":1436908617099,"_cnpm_publish_time":1436908617099,"dist-tags":{"latest":"0.6.0"}}