{"_id":"@0xdoublesharp/bin-packing","_rev":"5-7a657f3782e4fe3e21f2e91f27199a61","name":"@0xdoublesharp/bin-packing","dist-tags":{"latest":"0.4.0"},"versions":{"0.1.0":{"name":"@0xdoublesharp/bin-packing","version":"0.1.0","license":"MIT","_id":"@0xdoublesharp/bin-packing@0.1.0","maintainers":[{"name":"doublesharp","email":"jsilver@doublesharp.com"}],"homepage":"https://github.com/doublesharp/bin-packing#readme","bugs":{"url":"https://github.com/doublesharp/bin-packing/issues"},"dist":{"shasum":"ca860e7c3359cc3367eb517081e1691556dbf063","tarball":"https://registry.npmjs.org/@0xdoublesharp/bin-packing/-/bin-packing-0.1.0.tgz","fileCount":10,"integrity":"sha512-xPdcILTRQ70m6OcM+LREf6/bmP0erPAzutyIVf2bpYAfVxmAgAoHBtEbrNdxS1q8ZWdWlyLcwhFOBDKEB33WIQ==","signatures":[{"sig":"MEQCICbetQJ7Hv72Tbacl0LGOYXlMuT/6o4UTlqTw89uZ88IAiB2lah7DupDq8+PKldqwrJCBeDQWqqvUh7rh0ndnQz+WA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@0xdoublesharp%2fbin-packing@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":7789225},"main":"wrapper.js","napi":{"targets":["x86_64-unknown-linux-gnu","aarch64-unknown-linux-gnu","x86_64-apple-darwin","aarch64-apple-darwin","x86_64-pc-windows-msvc","aarch64-pc-windows-msvc"],"npmClient":"npm","binaryName":"bin-packing","packageName":"@0xdoublesharp/bin-packing"},"types":"wrapper.d.ts","engines":{"node":">=18"},"gitHead":"104b8eb0de1745e62d13f0c528daadc3cc156b02","scripts":{"test":"node --test test/smoke.test.js","build":"napi build --platform --release","artifacts":"napi artifacts --output-dir artifacts","build:debug":"napi build --platform","create:npm-dirs":"napi create-npm-dirs","prepublish:native":"napi pre-publish --tag-style npm"},"_npmUser":{"name":"doublesharp","email":"jsilver@doublesharp.com"},"repository":{"url":"git+https://github.com/doublesharp/bin-packing.git","type":"git","directory":"bindings/node"},"_npmVersion":"10.9.7","description":"Node.js bindings for the 0xdoublesharp bin-packing optimizer","directories":{},"_nodeVersion":"22.22.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@10.25.0","devDependencies":{"@napi-rs/cli":"^3.6.1"},"_npmOperationalInternal":{"tmp":"tmp/bin-packing_0.1.0_1775981619824_0.1468916776713336","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@0xdoublesharp/bin-packing","version":"0.1.1","license":"MIT","_id":"@0xdoublesharp/bin-packing@0.1.1","maintainers":[{"name":"doublesharp","email":"jsilver@doublesharp.com"}],"homepage":"https://github.com/doublesharp/bin-packing#readme","bugs":{"url":"https://github.com/doublesharp/bin-packing/issues"},"dist":{"shasum":"153ff381b1670463885dd4853452b3e8f3cc8868","tarball":"https://registry.npmjs.org/@0xdoublesharp/bin-packing/-/bin-packing-0.1.1.tgz","fileCount":11,"integrity":"sha512-qW3OHi6tzSqut8QkraQsmCphMQuIYXQjruXmNRk3ym8Na0fqPrJNsqK5LbbwXyUqSdNnm6H9S9jrj7rsCVdoJQ==","signatures":[{"sig":"MEUCIQDhyD/fi2LlYuXuDQ5tz6AdaETh0KIjquZAAFGDHKQGWAIgS1kA9g8S4Xs5C577E+MC3+CxWWSqOpOXIRA+X4wWyxE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@0xdoublesharp%2fbin-packing@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":7792744},"main":"wrapper.js","napi":{"targets":["x86_64-unknown-linux-gnu","aarch64-unknown-linux-gnu","x86_64-apple-darwin","aarch64-apple-darwin","x86_64-pc-windows-msvc","aarch64-pc-windows-msvc"],"npmClient":"npm","binaryName":"bin-packing","packageName":"@0xdoublesharp/bin-packing"},"types":"wrapper.d.ts","engines":{"node":">=18"},"gitHead":"867f20dd8480f7fc6782ebdd676f449f8705ce03","scripts":{"test":"node --test test/smoke.test.js","build":"napi build --platform --release","artifacts":"napi artifacts --output-dir artifacts","build:debug":"napi build --platform","create:npm-dirs":"napi create-npm-dirs","prepublish:native":"napi pre-publish --tag-style npm"},"_npmUser":{"name":"doublesharp","email":"jsilver@doublesharp.com"},"repository":{"url":"git+https://github.com/doublesharp/bin-packing.git","type":"git","directory":"bindings/node"},"_npmVersion":"10.9.7","description":"Node.js bindings for the 0xdoublesharp bin-packing optimizer","directories":{},"_nodeVersion":"22.22.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@10.25.0","devDependencies":{"@napi-rs/cli":"^3.6.1"},"_npmOperationalInternal":{"tmp":"tmp/bin-packing_0.1.1_1775982349765_0.4676641120246652","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@0xdoublesharp/bin-packing","version":"0.2.0","license":"MIT","_id":"@0xdoublesharp/bin-packing@0.2.0","maintainers":[{"name":"doublesharp","email":"jsilver@doublesharp.com"}],"homepage":"https://github.com/doublesharp/bin-packing#readme","bugs":{"url":"https://github.com/doublesharp/bin-packing/issues"},"dist":{"shasum":"ee66ee9ade518ebf5015d4cf5b22a261f50ceffb","tarball":"https://registry.npmjs.org/@0xdoublesharp/bin-packing/-/bin-packing-0.2.0.tgz","fileCount":11,"integrity":"sha512-AiKJ4g9uTTFU1E04YFvruIhzpjJfpis0nGQmqD7ZTB5KVzTz4/LWuokt/suHUg6lbZI6ExvFEYiFSLPwC1uz0Q==","signatures":[{"sig":"MEYCIQD2Q6NhpwcZe2Ii2lek7L4MMGxe98Iyk0yJMbgoByAZdwIhAK17zAaqzXXFA4mLFfYLPszfxF122dhgVULDztOzTdI+","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@0xdoublesharp%2fbin-packing@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":9574557},"main":"wrapper.js","napi":{"targets":["x86_64-unknown-linux-gnu","aarch64-unknown-linux-gnu","x86_64-apple-darwin","aarch64-apple-darwin","x86_64-pc-windows-msvc","aarch64-pc-windows-msvc"],"npmClient":"npm","binaryName":"bin-packing","packageName":"@0xdoublesharp/bin-packing"},"types":"wrapper.d.ts","engines":{"node":">=18"},"gitHead":"d51f8d979d04754b32d943b37fbcd7be8c611b09","scripts":{"test":"node --test test/smoke.test.js","build":"napi build --platform --release","artifacts":"napi artifacts --output-dir artifacts","build:debug":"napi build --platform","create:npm-dirs":"napi create-npm-dirs","prepublish:native":"napi pre-publish --tag-style npm"},"_npmUser":{"name":"doublesharp","email":"jsilver@doublesharp.com"},"repository":{"url":"git+https://github.com/doublesharp/bin-packing.git","type":"git","directory":"bindings/node"},"_npmVersion":"10.9.7","description":"Node.js bindings for the 0xdoublesharp bin-packing optimizer","directories":{},"_nodeVersion":"22.22.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@10.25.0","devDependencies":{"@napi-rs/cli":"^3.6.1"},"_npmOperationalInternal":{"tmp":"tmp/bin-packing_0.2.0_1776212019003_0.38042734468865547","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@0xdoublesharp/bin-packing","version":"0.3.0","license":"MIT","_id":"@0xdoublesharp/bin-packing@0.3.0","maintainers":[{"name":"doublesharp","email":"jsilver@doublesharp.com"}],"homepage":"https://github.com/doublesharp/bin-packing#readme","bugs":{"url":"https://github.com/doublesharp/bin-packing/issues"},"dist":{"shasum":"31211e040d475c930bcf8bd4b7810cfe65f9ceae","tarball":"https://registry.npmjs.org/@0xdoublesharp/bin-packing/-/bin-packing-0.3.0.tgz","fileCount":11,"integrity":"sha512-J+KB220zTjWQ8MzO9W6X3SyjJdkH1JjHu5E2F9mqBKwpFSH+mbb58RHegHhK2Xj6jHP0xl3O4lI6t9u/zaNpsQ==","signatures":[{"sig":"MEYCIQDQ+b5Zg/r5sqO5m3pVn+ZM8EnBolqMLmaAjSzPJU0dDgIhAL021lR+fi8AAUO6fTEaWhrrBVBCj481Is4kjSa32Rlx","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@0xdoublesharp%2fbin-packing@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":10989945},"main":"wrapper.js","napi":{"targets":["x86_64-unknown-linux-gnu","aarch64-unknown-linux-gnu","x86_64-apple-darwin","aarch64-apple-darwin","x86_64-pc-windows-msvc","aarch64-pc-windows-msvc"],"npmClient":"npm","binaryName":"bin-packing","packageName":"@0xdoublesharp/bin-packing"},"types":"wrapper.d.ts","engines":{"node":">=18"},"gitHead":"733c59b44b3763c1eed7e0a58bdb5ca6c73f7f0c","scripts":{"test":"node --test test/smoke.test.js","build":"napi build --platform --release","artifacts":"napi artifacts --output-dir artifacts","build:debug":"napi build --platform","create:npm-dirs":"napi create-npm-dirs","prepublish:native":"napi pre-publish --tag-style npm"},"_npmUser":{"name":"doublesharp","email":"jsilver@doublesharp.com"},"repository":{"url":"git+https://github.com/doublesharp/bin-packing.git","type":"git","directory":"bindings/node"},"_npmVersion":"10.9.7","description":"Node.js bindings for the 0xdoublesharp bin-packing optimizer","directories":{},"_nodeVersion":"22.22.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@10.25.0","devDependencies":{"@napi-rs/cli":"^3.6.1"},"_npmOperationalInternal":{"tmp":"tmp/bin-packing_0.3.0_1776311721823_0.6601630175684605","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@0xdoublesharp/bin-packing","version":"0.4.0","description":"Node.js bindings for the 0xdoublesharp bin-packing optimizer","license":"MIT","packageManager":"pnpm@10.25.0","repository":{"type":"git","url":"git+https://github.com/doublesharp/bin-packing.git","directory":"bindings/node"},"publishConfig":{"access":"public"},"main":"wrapper.js","types":"wrapper.d.ts","engines":{"node":">=18"},"napi":{"binaryName":"bin-packing","packageName":"@0xdoublesharp/bin-packing","npmClient":"npm","targets":["x86_64-unknown-linux-gnu","aarch64-unknown-linux-gnu","x86_64-apple-darwin","aarch64-apple-darwin","x86_64-pc-windows-msvc","aarch64-pc-windows-msvc"]},"scripts":{"artifacts":"napi artifacts --output-dir artifacts","build":"napi build --platform --release","build:debug":"napi build --platform","create:npm-dirs":"napi create-npm-dirs","prepublish:native":"napi pre-publish --tag-style npm","test":"node --test test/smoke.test.js ../test/finder.test.cjs","test:package":"node ../test/package-native.cjs"},"devDependencies":{"@napi-rs/cli":"^3.6.1"},"optionalDependencies":{"@0xdoublesharp/bin-packing-linux-x64-gnu":"0.4.0","@0xdoublesharp/bin-packing-linux-arm64-gnu":"0.4.0","@0xdoublesharp/bin-packing-darwin-x64":"0.4.0","@0xdoublesharp/bin-packing-darwin-arm64":"0.4.0","@0xdoublesharp/bin-packing-win32-x64-msvc":"0.4.0","@0xdoublesharp/bin-packing-win32-arm64-msvc":"0.4.0"},"gitHead":"3088b655e0d741b01d50061fb2300e6a99ccf8ee","_id":"@0xdoublesharp/bin-packing@0.4.0","bugs":{"url":"https://github.com/doublesharp/bin-packing/issues"},"homepage":"https://github.com/doublesharp/bin-packing#readme","_nodeVersion":"24.20.0","_npmVersion":"11.19.1","dist":{"integrity":"sha512-8mexouVKV+j8emVmDvBDNK+JkDBWP6qJWeCnKPA4CcmQLJq0s4bdpJ5lEKBXqHyF7ldecjLPD7+Uxf28jagtiA==","shasum":"29d2af6224ba762509db8464fad9d0d86153512e","tarball":"https://registry.npmjs.org/@0xdoublesharp/bin-packing/-/bin-packing-0.4.0.tgz","fileCount":12,"unpackedSize":12054601,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@0xdoublesharp%2fbin-packing@0.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGP3W6SISHH5qISp3RCo/Nprn/mdgKLxfK6Uz4sS8BmtAiEAmtoNoIaKiB6cZxhzmUlV9J0pZpxZKa8dg4Kss1Pmb6w="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c9eeebe0-9021-491b-8707-cb78d0643ebf"}},"directories":{},"maintainers":[{"name":"doublesharp","email":"jsilver@doublesharp.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bin-packing_0.4.0_1789008726658_0.024967339817447698"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-12T08:13:39.725Z","modified":"2026-09-10T02:52:07.273Z","0.1.0":"2026-04-12T08:13:40.162Z","0.1.1":"2026-04-12T08:25:50.084Z","0.2.0":"2026-04-15T00:13:39.298Z","0.3.0":"2026-04-16T03:55:22.100Z","0.4.0":"2026-09-10T02:52:06.906Z"},"bugs":{"url":"https://github.com/doublesharp/bin-packing/issues"},"license":"MIT","homepage":"https://github.com/doublesharp/bin-packing#readme","repository":{"type":"git","url":"git+https://github.com/doublesharp/bin-packing.git","directory":"bindings/node"},"description":"Node.js bindings for the 0xdoublesharp bin-packing optimizer","maintainers":[{"name":"doublesharp","email":"jsilver@doublesharp.com"}],"readme":"<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/doublesharp/bin-packing/main/docs/bin-packing.png\" alt=\"bin-packing\" width=\"200\">\n</p>\n\n# @0xdoublesharp/bin-packing\n\nNative Node.js bindings for the [`bin-packing`](https://crates.io/crates/bin-packing)\nRust crate — a cut list and bin packing optimizer for 1D cutting stock (linear\nbar / pipe), 2D rectangular sheet packing, and 3D box packing.\n\nPrebuilt binaries for Linux (x64, arm64), macOS (x64, arm64), and Windows\n(x64, arm64). No Rust toolchain required.\n\n## Install\n\n```sh\npnpm add @0xdoublesharp/bin-packing\n```\n\n## Usage\n\n```js\nconst { solve1d, solve2d, solve3d } = require('@0xdoublesharp/bin-packing');\n\n// 1D cutting stock\nconst cuts = solve1d(\n  {\n    stock: [{ name: 'bar', length: 100 }],\n    demands: [\n      { name: 'A', length: 45, quantity: 2 },\n      { name: 'B', length: 30, quantity: 2 },\n    ],\n  },\n  { algorithm: 'auto' },\n);\n\n// 2D sheet packing\nconst sheets = solve2d(\n  {\n    sheets: [{ name: 'plywood', width: 96, height: 48, kerf: 2 }],\n    demands: [\n      { name: 'panel', width: 24, height: 18, quantity: 4, can_rotate: true },\n    ],\n  },\n  { algorithm: 'auto', min_usable_side: 12 },\n);\n\n// 2D cut plan — generate an ordered cut sequence from a finished layout\nconst { plan2dCuts } = require('@0xdoublesharp/bin-packing');\n\nconst cutPlan = plan2dCuts(\n  sheets,\n  { preset: 'table_saw' },\n);\n\n// cutPlan.total_cost — aggregate cost for all sheets under the chosen preset\n// cutPlan.sheet_plans — array of per-sheet plans; each carries:\n//   .steps        — ordered array of cut steps (cut, line_cut, rotate, fence_reset, …)\n//   .total_cost   — cost for this sheet\n//   .num_cuts, .num_rotations, .num_fence_resets, .num_tool_ups, .travel_distance\n\n// 3D box packing\nconst bins = solve3d(\n  {\n    bins: [{ name: 'crate', width: 60, height: 40, depth: 30 }],\n    demands: [\n      { name: 'box_a', width: 10, height: 10, depth: 10, quantity: 3 },\n      { name: 'box_b', width: 8, height: 6, depth: 5, quantity: 2 },\n    ],\n  },\n  { algorithm: 'auto' },\n);\n```\n\nAll three functions accept a problem object and an optional options object,\nand return a solution object. Full TypeScript types are included.\n\n### Edge kerf relief\n\nSet `edge_kerf_relief: true` on a sheet when the final cut on each\naxis can run off the stock, consuming less than a full kerf of\nmaterial:\n\n```js\nsheets: [\n  {\n    name: 'plywood',\n    width: 48000,\n    height: 96000,\n    kerf: 125,\n    edge_kerf_relief: true,\n  },\n];\n```\n\nEach part must still fit within the sheet's own dimensions, but the\nlast placement on a row or column may extend by up to one kerf past\nthe sheet boundary — the model treats this as the blade exiting the\nmaterial.\n\n## API\n\n### `plan2dCuts(solution, options?)`\n\nGenerates an ordered cut plan for every sheet in a finished `TwoDSolution`.\nPresets: `table_saw`, `panel_saw`, `cnc_router`.\n\nThe returned plan carries per-sheet steps and a `total_cost`. Each sheet plan\nincludes an ordered `steps` array and counters for cuts, rotations, fence\nresets, tool ups, and travel distance.\n\nThrows when `table_saw` or `panel_saw` is used on a non-guillotine layout\n(`NonGuillotineNotCuttable`) or when a cost override is invalid\n(`InvalidOptions`). Use `cnc_router` as the universal fallback.\n\n### `plan1dCuts(solution, options?)`\n\nGenerates an ordered cut plan for every bar in a finished `OneDSolution`.\nThe only preset is `chop_saw`. The returned plan carries per-bar steps\n(`cut` and `fence_reset`) and a `total_cost`.\n\n### `solve1d(problem, options?)`\n\nAlgorithms: `auto`, `first_fit_decreasing`, `best_fit_decreasing`,\n`local_search`, `column_generation`.\n\n### `solve2d(problem, options?)`\n\nAlgorithms: `auto`, `max_rects`, `max_rects_best_short_side_fit`,\n`max_rects_best_long_side_fit`, `max_rects_bottom_left`,\n`max_rects_contact_point`, `skyline`, `skyline_min_waste`, `guillotine`,\n`guillotine_best_short_side_fit`, `guillotine_best_long_side_fit`,\n`guillotine_shorter_leftover_axis`, `guillotine_longer_leftover_axis`,\n`guillotine_min_area_split`, `guillotine_max_area_split`,\n`next_fit_decreasing_height`, `first_fit_decreasing_height`,\n`best_fit_decreasing_height`, `multi_start`, `rotation_search`.\n\n### `solve3d(problem, options?)`\n\nAlgorithms: `auto`, `extreme_points`, `extreme_points_residual_space`,\n`extreme_points_free_volume`, `extreme_points_bottom_left_back`,\n`extreme_points_contact_point`, `extreme_points_euclidean`, `guillotine_3d`,\n`guillotine_3d_best_short_side_fit`, `guillotine_3d_best_long_side_fit`,\n`guillotine_3d_shorter_leftover_axis`, `guillotine_3d_longer_leftover_axis`,\n`guillotine_3d_min_volume_split`, `guillotine_3d_max_volume_split`,\n`layer_building`, `layer_building_max_rects`, `layer_building_skyline`,\n`layer_building_guillotine`, `layer_building_shelf`, `wall_building`,\n`column_building`, `deepest_bottom_left`, `deepest_bottom_left_fill`,\n`first_fit_decreasing_volume`, `best_fit_decreasing_volume`, `multi_start`,\n`grasp`, `local_search`, `branch_and_bound`.\n\n### `version()`\n\nReturns the package version string.\n\n## WASM alternative\n\nFor browsers, Deno, Cloudflare Workers, or environments without native\nbinaries, see\n[`@0xdoublesharp/bin-packing-wasm`](https://www.npmjs.com/package/@0xdoublesharp/bin-packing-wasm).\n\n## License\n\nMIT\n\n### Workpiece-aware saw jobs\n\n`plan2dSawCuts(job, options?)` is the opt-in physical planner. Supply the original\nproblem, layouts, and explicit stock/demand index maps. It returns one ordered job\nwith workpiece ancestry, kerf bands, real settings and measured operation counts.\nSee [the API and migration guide](../../docs/two-d/saw-planner.md) and run\n`node ../../examples/saw-planner.mjs native` after building this package.\n","readmeFilename":"README.md"}