{"_id":"@ain1084/array-buffer-partitioner","_rev":"5-0bd85e27c96bb27945507f56d69d5133","name":"@ain1084/array-buffer-partitioner","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.1":{"name":"@ain1084/array-buffer-partitioner","version":"0.0.1","keywords":["ArrayBuffer","SharedArrayBuffer","TypedArray","partition","allocator","buffer","views"],"author":{"name":"Seiji Ainoguchi","email":"seiji.ainoguchi@gmail.com"},"license":"(MIT OR Apache-2.0)","_id":"@ain1084/array-buffer-partitioner@0.0.1","maintainers":[{"name":"ain1084","email":"seiji.ainoguchi@gmail.com"}],"homepage":"https://github.com/ain1084/array-buffer-partitioner#readme","bugs":{"url":"https://github.com/ain1084/array-buffer-partitioner/issues"},"dist":{"shasum":"372dcf73f0fa422eaa26b3fee0e7822d718fe628","tarball":"https://registry.npmjs.org/@ain1084/array-buffer-partitioner/-/array-buffer-partitioner-0.0.1.tgz","fileCount":7,"integrity":"sha512-5X51ksDcwWHS75fwpIdStmJE67E3InDgQ/gTFjnkkCynPQXa8FWdQLKdrHTCYi7PgE5NXs3+nPq9VT1FdAx9kQ==","signatures":[{"sig":"MEUCIHqbrjDP/fld10sBN8cgMePOTcAGvEltktoZBuh/ElNtAiEA89L+CKY4Hpu5C8EEJ3QXM862h+Jqj842GtSxfZ6yEds=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24815},"types":"dist/index.d.ts","module":"dist/index.js","gitHead":"311ae73dc1061eadc91ec55ab4439686f4d315cd","scripts":{"docs":"typedoc","test":"jest","build":"tsc","clean":"rm -rf dist docs","test:watch":"jest --watch","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"ain1084","email":"seiji.ainoguchi@gmail.com"},"deprecated":"This version has critical issues and should not be used. Please wait for a fixed version or refer to an alternative solution.","repository":{"url":"git+https://github.com/ain1084/array-buffer-partitioner.git","type":"git"},"_npmVersion":"10.8.3","description":"Partition an ArrayBuffer into multiple TypedArray views efficiently.","directories":{},"_nodeVersion":"22.9.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.0","ts-jest":"^29.2.5","typedoc":"^0.26.10","typescript":"^5.6.3","@types/jest":"^29.5.14"},"_npmOperationalInternal":{"tmp":"tmp/array-buffer-partitioner_0.0.1_1729914990058_0.44430802676946834","host":"s3://npm-registry-packages"}},"0.0.3":{"name":"@ain1084/array-buffer-partitioner","version":"0.0.3","keywords":["ArrayBuffer","SharedArrayBuffer","TypedArray","partition","allocator","buffer","views"],"author":{"name":"Seiji Ainoguchi","email":"seiji.ainoguchi@gmail.com"},"license":"(MIT OR Apache-2.0)","_id":"@ain1084/array-buffer-partitioner@0.0.3","maintainers":[{"name":"ain1084","email":"seiji.ainoguchi@gmail.com"}],"homepage":"https://github.com/ain1084/array-buffer-partitioner#readme","bugs":{"url":"https://github.com/ain1084/array-buffer-partitioner/issues"},"dist":{"shasum":"6c9e8fea24a304e49a7e6818a8cb426038888ea4","tarball":"https://registry.npmjs.org/@ain1084/array-buffer-partitioner/-/array-buffer-partitioner-0.0.3.tgz","fileCount":7,"integrity":"sha512-41ZordwQiLf8GQITZNZby39IIJJbsJwryWrdiYCVjXDGJ82dTb+QQBys9G1MZ17WIgBwz72Jkn0ccTXgwBdy+w==","signatures":[{"sig":"MEUCIQCCSTxqTiZq1ihppQcV9m3uGXeog/5DR1gxvQsirE6W/gIgK8lPmQOdPq6ysVYR1DushgWNidCCe7jdU6cHE7+ALZE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24956},"types":"dist/index.d.ts","module":"dist/index.js","gitHead":"53c4496d49c36b468b9d09d94e864ded48cb73fc","scripts":{"docs":"typedoc","test":"jest","build":"tsc","clean":"rm -rf dist docs","test:watch":"jest --watch","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"ain1084","email":"seiji.ainoguchi@gmail.com"},"repository":{"url":"git+https://github.com/ain1084/array-buffer-partitioner.git","type":"git"},"_npmVersion":"10.8.3","description":"Partition an ArrayBuffer into multiple TypedArray views efficiently.","directories":{},"_nodeVersion":"22.9.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.0","ts-jest":"^29.2.5","typedoc":"^0.26.10","typescript":"^5.6.3","@types/jest":"^29.5.14"},"_npmOperationalInternal":{"tmp":"tmp/array-buffer-partitioner_0.0.3_1729933706049_0.8753143127302248","host":"s3://npm-registry-packages"}},"0.0.4":{"name":"@ain1084/array-buffer-partitioner","version":"0.0.4","description":"Partition an ArrayBuffer into multiple TypedArray views efficiently.","type":"module","exports":{".":"./dist/index.js"},"types":"./dist/index.d.ts","scripts":{"build":"tsc","clean":"rm -rf ./dist docs","prepublishOnly":"npm run clean && npm run build","test":"jest","test:watch":"jest --watch","docs":"typedoc"},"keywords":["ArrayBuffer","SharedArrayBuffer","TypedArray","partition","allocator","buffer","views"],"author":{"name":"Seiji Ainoguchi","email":"seiji.ainoguchi@gmail.com"},"license":"(MIT OR Apache-2.0)","repository":{"type":"git","url":"git+https://github.com/ain1084/array-buffer-partitioner.git"},"bugs":{"url":"https://github.com/ain1084/array-buffer-partitioner/issues"},"homepage":"https://github.com/ain1084/array-buffer-partitioner#readme","devDependencies":{"@types/jest":"^29.5.14","jest":"^29.0.0","ts-jest":"^29.2.5","typedoc":"^0.26.11","typescript":"^5.6.3"},"_id":"@ain1084/array-buffer-partitioner@0.0.4","gitHead":"f23c2b310e7fa7bf84a4002734acca37a6a8a6e8","_nodeVersion":"22.9.0","_npmVersion":"10.8.3","dist":{"integrity":"sha512-BCts0cXEiqxhiIsAJ8nrWcN6PcO43HzeaV7c8aDOEbww5rP6u5i1mQJk0epeEflJnRAP9XlDx3wZ58II4jIqXQ==","shasum":"4d425bfab7078907a9c52c49857a21cf6b7408a6","tarball":"https://registry.npmjs.org/@ain1084/array-buffer-partitioner/-/array-buffer-partitioner-0.0.4.tgz","fileCount":7,"unpackedSize":25134,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICDUTrNrM9LuIos2FvvkQ+y3Dpu7d2ESVKalRL84pFEHAiBUR88n6NiBTukLTz1whb13ErsBNCQh88GX7FTJqNv8Qg=="}]},"_npmUser":{"name":"ain1084","email":"seiji.ainoguchi@gmail.com"},"directories":{},"maintainers":[{"name":"ain1084","email":"seiji.ainoguchi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/array-buffer-partitioner_0.0.4_1730480851367_0.37879298618273594"},"_hasShrinkwrap":false}},"time":{"created":"2024-10-26T03:56:29.962Z","modified":"2024-11-01T17:07:31.692Z","0.0.1":"2024-10-26T03:56:30.254Z","0.0.2":"2024-10-26T04:30:01.745Z","0.0.3":"2024-10-26T09:08:26.247Z","0.0.4":"2024-11-01T17:07:31.538Z"},"bugs":{"url":"https://github.com/ain1084/array-buffer-partitioner/issues"},"author":{"name":"Seiji Ainoguchi","email":"seiji.ainoguchi@gmail.com"},"license":"(MIT OR Apache-2.0)","homepage":"https://github.com/ain1084/array-buffer-partitioner#readme","keywords":["ArrayBuffer","SharedArrayBuffer","TypedArray","partition","allocator","buffer","views"],"repository":{"type":"git","url":"git+https://github.com/ain1084/array-buffer-partitioner.git"},"description":"Partition an ArrayBuffer into multiple TypedArray views efficiently.","maintainers":[{"name":"ain1084","email":"seiji.ainoguchi@gmail.com"}],"readme":"# Array Buffer Partitioner\n\n[![npm version](https://badge.fury.io/js/@ain1084%2Farray-buffer-partitioner.svg)](https://badge.fury.io/js/@ain1084%2Farray-buffer-partitioner)\n[![CI](https://github.com/ain1084/array-buffer-partitioner/actions/workflows/ci.yml/badge.svg)](https://github.com/ain1084/array-buffer-partitioner/actions?query=workflow%3Aci)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nPartition an ArrayBuffer into multiple TypedArray views efficiently, while handling complex memory layouts and ensuring optimal alignment for better access performance.\n\n## Overview\n\n`@ain1084/array-buffer-partitioner` is a utility library for creating multiple TypedArray views on a single `ArrayBuffer` or `SharedArrayBuffer`. This allows various data types to be efficiently placed within a single buffer. The library automatically adjusts each TypedArray’s byteOffset to prevent errors that can occur during view creation.\n\n### Features\n\n- Create multiple `TypedArray` views from a single `ArrayBuffer` or `SharedArrayBuffer`.\n- Efficient memory partitioning without manual offset calculations.\n\n## Installation\n\nInstall the library via npm:\n\n```sh\nnpm i @ain1084/array-buffer-partitioner\n```\n\n## Usage\n\nImport the `createArrayBufferViews` function to partition an `ArrayBuffer` or `SharedArrayBuffer` into multiple views:\n\n```typescript\nimport { createArrayBufferViews } from '@ain1084/array-buffer-partitioner';\n\nconst views = createArrayBufferViews(ArrayBuffer, {\n  data: [Float32Array, 1024],\n  index: [Uint32Array, 1],\n  flag: [Uint8Array, 1]\n});\n\nconsole.log(views.data.length); // 1024\nconsole.log(views.data.byteOffset); // 0\nconsole.log(views.index.length); // 1\nconsole.log(views.flag.length); // 1\nconsole.log(views.flag.byteOffset); // 4100\nconsole.log(views.data.buffer.byteLength); // 4104\n```\n\n## API\n\nFor detailed API documentation, please refer to the [GitHub Pages](https://ain1084.github.io/array-buffer-partitioner/) documentation.\n\n### `createArrayBufferViews(BufferType: { new(size: number): ArrayBuffer | SharedArrayBuffer }, config: Record<string, [TypedArrayConstructor, number]>)`\n\nCreates multiple `TypedArray` views on a single `ArrayBuffer` or `SharedArrayBuffer`.\n\n#### Parameters\n\n- `BufferType` (`{ new(size: number): ArrayBuffer | SharedArrayBuffer }`): The constructor for the buffer, either `ArrayBuffer` or `SharedArrayBuffer`.\n- `config` (`Record<string, [TypedArrayConstructor, number]>`): An object specifying the desired views. Each key represents the name of the view, and the value is a tuple where:\n  - The first element is the `TypedArray` class name (e.g., `Float32Array`, `Uint32Array`).\n  - The second element is the number of elements for that view.\n\n#### Returns\n\nAn object containing the views, with each key corresponding to the provided configuration.\n\n## Contributing\n\nContributions are welcome! If you have ideas, suggestions, or issues, please create an issue on the [GitHub repository](https://github.com/ain1084/array-buffer-partitioner).\n\n## License\n\nThis project is licensed under the MIT OR Apache-2.0 license.\n","readmeFilename":"README.md"}