{"name":"memcpy","version":"0.4.0","author":{"name":"Daniel Wirtz","email":"dcode@dcode.io"},"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":"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"},"devDependencies":{"testjs":"latest"},"license":"Apache-2.0","engines":{"node":">=0.8"},"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"},"_id":"memcpy@0.4.0","dist":{"shasum":"a789c37a14fbbf6f76b3ee049d74b87fef544644","tarball":"http://registry-npm.ywwl.com/memcpy/download/memcpy-0.4.0.tgz","integrity":"sha512-Mzx+KfC7kNcYjN23tCVzQ22E+1W0pGQV4tp6GJQAi/FU9Il3sUJhwM320RQinfRtyDZ0N8efSheg9zWQUyw6QA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCDOA+5R31Swsit5LZjxI0Ymmbb/papxgBn+4yELiDr3gIhAPhZgMrlUC8EaBnXTic4NVXWYu/nWpeG2YTDicfC0W41"}],"size":8165,"noattachment":false,"key":"/memcpy/-/memcpy-0.4.0.tgz"},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"dcode","email":"dcode@dcode.io"},"maintainers":[{"name":"dcode","email":"dcode@dcode.io"}],"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":1388623972484,"_cnpm_publish_time":1388623972484,"dist-tags":{"latest":"0.6.0"}}