{"_id":"@dstanesc/wasm-chunking-fastcdc-node","_rev":"1-c19216714e7928efe85f23889bec35b3","name":"@dstanesc/wasm-chunking-fastcdc-node","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@dstanesc/wasm-chunking-fastcdc-node","decription":"Wasm library for FastCDC content-defined slicing for NodeJS. This is a convenience wrapper on the existing existing [rust implementation](https://github.com/nlfiedler/fastcdc-rs)","homepage":"https://github.com/dstanesc/wasm-chunking-fastcdc","author":{"name":"Hexagon and contributors"},"keywords":["fastcdc","wasm","nodejs","chunking","cdc"],"collaborators":["dstanesc <dstanesc@gmail.com>"],"description":"This crate generates WebAssembly bindings to the FastCDC content defined slicing library","version":"0.1.0","license":"MIT OR Apache-2.0","repository":{"type":"git","url":"git+https://github.com/dstanesc/wasm-chunking-fastcdc.git"},"main":"chunking.js","types":"chunking.d.ts","gitHead":"601d46e3086e42921caeda44d6c0f6a971191f34","bugs":{"url":"https://github.com/dstanesc/wasm-chunking-fastcdc/issues"},"_id":"@dstanesc/wasm-chunking-fastcdc-node@0.1.0","_nodeVersion":"16.13.1","_npmVersion":"8.17.0","dist":{"integrity":"sha512-UTGhg+YT8TVdPKJ36zNW/n0wfFAKgnEZKwXcceanVwktlZ6aZVDEJ71iQk32U2s8zqqV9qyvo/rP3hNM7B86yQ==","shasum":"1dc7ab475b002f7d73202efb0d499242e6a0efe4","tarball":"https://registry.npmjs.org/@dstanesc/wasm-chunking-fastcdc-node/-/wasm-chunking-fastcdc-node-0.1.0.tgz","fileCount":7,"unpackedSize":43387,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH34AP6NvLCFIxXstlXVK6k6kMhiCeFwvS67VSzmcGpcAiAO0jK6iQIOU2D+0wDDHf4NIFN14Lo++tDhNUPzpWpoBw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjKQ0RACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpihg/+IJKWI2taLqb9b/PY5I2p4lM8xp8W5yzEewBmiHvTK47jiHqc\r\nJEAbqgDZvup5GTyWKa3PlEvIN1qGBNjRor9x/ciL0RRb+Eetb/W4KNT41RN6\r\ngmGLYQ9ShgGo9VMPGygPwYCc7c/UbYsZ3MokjzgB32/Hg7u28zstOnmPtupr\r\nzL8cx2SIMZk7Yft4ZQL8A8lNX9mSwYwf76D2eCBnlK/qLxoGYe7B5uftaPrU\r\n6UOBuaSHAhzQxb9F63JmDqX3xzr14lrui7IV+TEwgUqPee+PjLxcBo4ZRyQf\r\nluksJZSTp9LWmen3SBnhVstBWbjxZj2m7hjsi4ZwZmvumJJE0bABDu3dh7fT\r\noM+80ktYYTtZFv2f0twmKu+0B8C+bkCABU0h0YIQKqAQVbNOS9+kCmXKqiib\r\n01aNdbI2VqZgzfJ3odFO9Jai5M6VQna2ficvuwreBrnaru9tOj97Ilg/ZTpS\r\nGKpHRyNcvmeSlCcWSu0P8NEEa8FGvzY8nSoJxLGPyGW+ToKO7I8b+WY5oidy\r\nWxpre3TfuGnNWcWRXhUkeL8Ae+X0g5Xv0ueA7Tz6lc238PDOBOrJyAB0A54y\r\nGVz7a7Y0ogJxywyCgCor36wJZLgPYXCaOhWNH+ISIHNHP/3mgB95bjZe+yEa\r\njNwUP26y9agRHn6rFRY1naWWSQQoGrRnwD0=\r\n=HOS7\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dstanesc","email":"dstanesc@gmail.com"},"directories":{},"maintainers":[{"name":"dstanesc","email":"dstanesc@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/wasm-chunking-fastcdc-node_0.1.0_1663634705151_0.7191822387151783"},"_hasShrinkwrap":false},"0.1.1":{"name":"@dstanesc/wasm-chunking-fastcdc-node","decription":"Wasm library for FastCDC content-defined slicing for NodeJS. This is a convenience wrapper on the existing existing [rust implementation](https://github.com/nlfiedler/fastcdc-rs)","homepage":"https://github.com/dstanesc/wasm-chunking-fastcdc","author":{"name":"Hexagon and contributors"},"keywords":["fastcdc","wasm","nodejs","chunking","cdc"],"collaborators":["dstanesc <dstanesc@gmail.com>"],"description":"This crate generates WebAssembly bindings to the FastCDC content defined slicing library","version":"0.1.1","license":"MIT OR Apache-2.0","repository":{"type":"git","url":"git+https://github.com/dstanesc/wasm-chunking-fastcdc.git"},"main":"chunking.js","types":"chunking.d.ts","gitHead":"3d2f1d9467538b6ce4a69ff817fade1193133362","bugs":{"url":"https://github.com/dstanesc/wasm-chunking-fastcdc/issues"},"_id":"@dstanesc/wasm-chunking-fastcdc-node@0.1.1","_nodeVersion":"16.13.1","_npmVersion":"8.17.0","dist":{"integrity":"sha512-sR3SEdei2sPhOoK+1GTnQNyuFv1SDjSaxDdZGAKkzaYJzdOAccGxVUJy+oGxzVmt7BTWiUriAIAlOxfO/m1S5A==","shasum":"290faafc6a33eaf4e604e2ebbea40b9eff643bca","tarball":"https://registry.npmjs.org/@dstanesc/wasm-chunking-fastcdc-node/-/wasm-chunking-fastcdc-node-0.1.1.tgz","fileCount":5,"unpackedSize":31609,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDiepESCUt33r3kqyr01arZ9tndCSJLe3PC/3s58UmtxwIhAPDW6y0tCTqL8GFtPn3ho1fXr1ouqF6C1bhfIW64t1oc"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjKRihACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoGVBAAkrOPmmjv1iOjcNJb+MyaKGYWjpeNebo0Rj1L0NjqoRzCNby9\r\nUcTWmS6CaLXitp2x5wgesOKeSqlhiZnAixxTwN8ZKPsLgDYa+raPJC7lnoDt\r\nkB79I4H8Q3NZYyTEPf+p7XxlKq6mPoqgWEu6UZa/TF2BJs/8HiFKsjS2VPLt\r\nHmAJrhek/Mz6r15e/iMBQMWpu941eDgsXdV+dlr6XnwmZPA52kakYh9p9wA/\r\naiSv0cQHx/CNBoQM1NBZYmfZIoCt/csePyB0osvy6B+ZxN805oQuY3InFV1f\r\nCUfphhf7uQ9ajux+GA3zkB5RudXfnNM2RGaLftK1qBks/vBdS/F8pZKXfdVg\r\nn5vCisrJJV31Mqi2F5jzG2rDxT0w44jRwX9A0GachZQLk3mUROD1k7amazgx\r\n+G0g15IEv0saiv563HaohxGtJQmVz8aaiIWzifGk7s6OEjEon4D8+Ts8QY9Y\r\nXFK1gXqHQ1JY4GjEuvUVILOBFge/gYA/qCq6TljvigCUkdFdwRyfsn1Yictv\r\nkcKvEoKS7UcehUN0zcccgYyQm8PLUFnTWKYFoe8yMTOsCYJm3hdpK6IyLjQD\r\nr+ql5TEYjux0dWIDu58WRjhI8bIFZ2nRe7UY4h7af5enMYsoOEh7MHl9a5Sm\r\nnqvWca2+08ZILRTYaHPzJJyXyU1OVDMO+wQ=\r\n=WfDz\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"dstanesc","email":"dstanesc@gmail.com"},"directories":{},"maintainers":[{"name":"dstanesc","email":"dstanesc@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/wasm-chunking-fastcdc-node_0.1.1_1663637665083_0.8307313280193334"},"_hasShrinkwrap":false}},"time":{"created":"2022-09-20T00:45:05.078Z","0.1.0":"2022-09-20T00:45:05.365Z","modified":"2022-09-20T01:34:25.387Z","0.1.1":"2022-09-20T01:34:25.301Z"},"maintainers":[{"name":"dstanesc","email":"dstanesc@gmail.com"}],"description":"This crate generates WebAssembly bindings to the FastCDC content defined slicing library","homepage":"https://github.com/dstanesc/wasm-chunking-fastcdc","keywords":["fastcdc","wasm","nodejs","chunking","cdc"],"repository":{"type":"git","url":"git+https://github.com/dstanesc/wasm-chunking-fastcdc.git"},"author":{"name":"Hexagon and contributors"},"bugs":{"url":"https://github.com/dstanesc/wasm-chunking-fastcdc/issues"},"license":"MIT OR Apache-2.0","readme":"## Wasm Chunking Fastcdc\n\nThis crate generates [WebAssembly](https://rustwasm.github.io/docs/book/what-is-webassembly.html) bindings to the [FastCDC](https://github.com/nlfiedler/fastcdc-rs) content defined slicing library. \n\n\n## Install for nodejs usage\n\n```\nnpm install @dstanesc/wasm-chunking-fastcdc-node\n```\n\n## Install for bundler usage\n\n```\nnpm install @dstanesc/wasm-chunking-fastcdc-webpack\n```\n\n\n## Usage TypeScript\n\n```js\n//import { compute_chunks } from \"@dstanesc/wasm-chunking-fastcdc-node\"\nimport { compute_chunks } from \"@dstanesc/wasm-chunking-fastcdc-webpack\"\nconst buf: Uint8Array  = ...\n// chunking  spec: min_size 16 KB, avg size 32 KB, max size 64 KB\nconst offsets: Uint32Array = compute_chunks(buf, 16384, 32768, 65536)   \n```\n\n\n## Wasm build requirements\n\n- [Rust toolchain](https://www.rust-lang.org/tools/install)\n- [Wasm-pack](https://rustwasm.github.io/wasm-pack/installer/)\n\n\n## Wasm build\n\n```sh\nwasm-pack build --out-dir pkg/webpack --out-name chunking --target bundler --scope dstanesc\nwasm-pack build --out-dir pkg/node --out-name chunking --target nodejs --scope dstanesc\n```\n\n## Wasm test\n\nInteractive mode, eg. to check debugging info in the console\n```sh\nwasm-pack test --firefox\n```\n\nHeadless mode\n```sh\nwasm-pack test --headless --firefox\n```\n\n## Pack for local usage\n\n```\nnpm pack pkg/node/\nnpm pack pkg/webpack/\n```\n\n\n## Rust API\n\n### Function wasm_chunking_fastcdc::compute_chunks\n\n```rs\npub fn compute_chunks(\n    source: &[u8], \n    min_size: u32, \n    avg_size: u32, \n    max_size: u32\n) -> Result<Vec<u32>, RangeError>\n```\n\nCompute chunks from a given slice of bytes.\n\nThe min_size specifies the preferred minimum chunk size, max_size the preferred maximum chunk size; the avg_size is the desired “normal size” of the chunks. The smallest acceptable min_size is 64 bytes and likewise 256 bytes and 1024 bytes for avg_size and respectively max_size\n\nA js_sys::RangeError is returned when the above chunking specification is out of range.\n\nExample:\n\n```rs\nuse wasm_chunking_fastcdc::compute_chunks;\nlet data: Vec<u8> = br\"Lorem ipsum dolor sit amet, consectetur adipiscing elit...put more bits in here...\".to_vec();\nlet slice: &[u8] = &data;\nlet min_size: u32 = 64;\nlet avg_size: u32 = 256;\nlet max_size: u32 = 1024;\nlet offsets: Vec<u32> = compute_chunks(slice, min_size, avg_size, max_size).unwrap();\n```\n\n## License\n\nLicensed under either [Apache 2.0](http://opensource.org/licenses/MIT) or [MIT](http://opensource.org/licenses/MIT) at your option.","readmeFilename":"README.md"}