{"_id":"memcpy","_rev":"25-0e6e997619d2c87c94056ca7d8402263","name":"memcpy","description":"Copies data between node Buffers and/or ArrayBuffers up to ~75 times faster than in pure JS.","dist-tags":{"latest":"0.6.0"},"versions":{"0.1.0":{"name":"memcpy","version":"0.1.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.1.0","dist":{"shasum":"7d86f165885ee36ef7638f36a1b4cd4b96cc093e","tarball":"https://registry.npmjs.org/memcpy/-/memcpy-0.1.0.tgz","integrity":"sha512-ALunjxzLS9w7HVMnwlrBZMC/bS1T4QwjtuPOEJLbooWIV39rZw0dfloU2/v+Q8aO/TGAgtJCEt5FPyhZYMgA/w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCDlB4vEijgbKzKNsgah8SMm0ri5qC4VSHF0MVRKC3S1QIhAJECmMeL7uD4cOU+i2OYeROt68B1r87lxyI0KT412Tzf"}]},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"dcode","email":"dcode@dcode.io"},"maintainers":[{"name":"dcode","email":"dcode@dcode.io"}],"directories":{}},"0.2.0":{"name":"memcpy","version":"0.2.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.2.0","dist":{"shasum":"acf1d1588c5a1d68f1219f56e662277adc41b687","tarball":"https://registry.npmjs.org/memcpy/-/memcpy-0.2.0.tgz","integrity":"sha512-tyvmVEv90rL4HNEW3cdoSCuwOpiD3r91ynm25xLG8GPB9Pcd/c9Bcc14CpE9WZZ3Yp//ERoA43yljDClYJty9A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCK4AtZVL1iSljaTFvF4i1EYHPx9rYIlUSASGeyIcTJHAIhAMSzZ7feKZ+u+n4yHkye8J6WpNMsm+slGQrDmV8HZ7ev"}]},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"dcode","email":"dcode@dcode.io"},"maintainers":[{"name":"dcode","email":"dcode@dcode.io"}]},"0.3.0":{"name":"memcpy","version":"0.3.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.3.0","dist":{"shasum":"1e7ceeb067650db2fa328b3d1a58b19a81b90978","tarball":"https://registry.npmjs.org/memcpy/-/memcpy-0.3.0.tgz","integrity":"sha512-AQn0VDQ05W9HRUILR5QSK0Q0M09pWhzjt7cDY/lEbfNjIK91aPTjNwCshlu7hV/SBhEqP0+H9/5UwW1zZmIprg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDaQVfL2YdaWeabAA7tagDoAka2UVfFJQ4joxgoF1v+CQIgAYPWpGd99wW7oYMQW/Mw0vsUuCllE1HVtON8GMyXwtU="}]},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"dcode","email":"dcode@dcode.io"},"maintainers":[{"name":"dcode","email":"dcode@dcode.io"}]},"0.4.0":{"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":"https://registry.npmjs.org/memcpy/-/memcpy-0.4.0.tgz","integrity":"sha512-Mzx+KfC7kNcYjN23tCVzQ22E+1W0pGQV4tp6GJQAi/FU9Il3sUJhwM320RQinfRtyDZ0N8efSheg9zWQUyw6QA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCDOA+5R31Swsit5LZjxI0Ymmbb/papxgBn+4yELiDr3gIhAPhZgMrlUC8EaBnXTic4NVXWYu/nWpeG2YTDicfC0W41"}]},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"dcode","email":"dcode@dcode.io"},"maintainers":[{"name":"dcode","email":"dcode@dcode.io"}]},"0.5.0":{"name":"memcpy","version":"0.5.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":"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"},"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"},"homepage":"https://github.com/dcodeIO/node-memcpy","_id":"memcpy@0.5.0","_shasum":"1816ca5824096112209fdbb84696d69280925cf0","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"dcode","email":"dcode@dcode.io"},"maintainers":[{"name":"dcode","email":"dcode@dcode.io"}],"dist":{"shasum":"1816ca5824096112209fdbb84696d69280925cf0","tarball":"https://registry.npmjs.org/memcpy/-/memcpy-0.5.0.tgz","integrity":"sha512-3HbJux2PE0j9Bf5JE8h51F8ogzeysqE3DSNEtZNxzneDFWGAQtcDOnlNPAu5gbz2mcORFYsJmWGMh/taPivUtw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEuxc4EL+NguUmMKX4XJF1wKaH5f2D1fMCJMqMDuFVqvAiAAwW4AY3yXyr/f1dZ9r9hjbMJXD22kTfgeNguS2XGCcg=="}]}},"0.6.0":{"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":"https://registry.npmjs.org/memcpy/-/memcpy-0.6.0.tgz","integrity":"sha512-pddUAVPxmI5H2mxN8YbcEamgXHII3b5HaPNw1FeK1FObYYlgWIsS71DH0qrflGXRBx+B+gQAO3/anqsAu4Nv3A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFgncc6cFikIRy5Duyleon3Xet7NiaNE0nmBYPkNxIuHAiEA3+q+UF+Q87Yx6LS5sre7UPoISmXiHW7FjQNpr3B1+Vc="}]}}},"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","maintainers":[{"name":"dcode","email":"dcode@dcode.io"}],"time":{"modified":"2022-06-19T17:43:21.829Z","created":"2013-12-31T17:37:56.229Z","0.1.0":"2013-12-31T17:37:57.219Z","0.2.0":"2014-01-01T18:46:42.752Z","0.3.0":"2014-01-01T22:40:20.847Z","0.4.0":"2014-01-02T00:52:52.484Z","0.5.0":"2014-06-27T14:00:23.273Z","0.6.0":"2015-07-14T21:16:57.099Z"},"author":{"name":"Daniel Wirtz","email":"dcode@dcode.io"},"repository":{"type":"git","url":"git+https://github.com/dcodeIO/node-memcpy.git"},"homepage":"https://github.com/dcodeIO/node-memcpy#readme","keywords":["array","buffer","arraybuffer","typed array"],"contributors":[{"name":"Denys Khanzhiyev","email":"xdenser@gmail.com"}],"bugs":{"url":"https://github.com/dcodeIO/node-memcpy/issues"},"license":"Apache-2.0","readmeFilename":"README.md","users":{"arover":true,"andr":true,"jackblackjack":true}}