{"_id":"@bun-win32/cabinet","_rev":"5-62a759948b671974bc4a858a7910dfa5","name":"@bun-win32/cabinet","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/cabinet","version":"1.0.0","keywords":["bun","ffi","win32","windows","cabinet","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/cabinet@1.0.0","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"b35dda003928f20464973bc993f86c705284727d","tarball":"https://registry.npmjs.org/@bun-win32/cabinet/-/cabinet-1.0.0.tgz","fileCount":6,"integrity":"sha512-Sf9SI0f/lPY60iCD256SufscTdRMjNyN3kJEpUZfihQCl8CAxBTvqn6wpPkwxSuJJD4ztFoXlnpgUAQSMqdKxg==","signatures":[{"sig":"MEUCIEF9JAU6G907DcqaxrjLNOcJwh70F8Y65mrzvX4/jBA/AiEAoAXOR3D/9G1qqCM6Xbh4hLiQi2xmZ7YHYG9bqDcWvmg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22130},"main":"./index.ts","type":"module","module":"index.ts","shasum":"b35dda003928f20464973bc993f86c705284727d","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:cabinet-workshop":"bun ./example/cabinet-workshop.ts","example:compression-arena":"bun ./example/compression-arena.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-Sf9SI0f/lPY60iCD256SufscTdRMjNyN3kJEpUZfihQCl8CAxBTvqn6wpPkwxSuJJD4ztFoXlnpgUAQSMqdKxg==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/cabinet"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 CABINET bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@bun-win32/kernel32":"1.0.21"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/cabinet_1.0.0_1779073001707_0.09300206604861927","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bun-win32/cabinet","version":"1.0.1","keywords":["bun","ffi","win32","windows","cabinet","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/cabinet@1.0.1","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"eff9227ad419bdffb4c55f4872e283f0ea4184da","tarball":"https://registry.npmjs.org/@bun-win32/cabinet/-/cabinet-1.0.1.tgz","fileCount":6,"integrity":"sha512-jDiYzNJlbef0572BbbLkyeMO9eaEEoYACt70AV/oMPiSNG1dEiaPGuM3qyaZaVoUF8fG/3LRfegQK9pU7XKMYw==","signatures":[{"sig":"MEQCICEfgcy1tXtN6XdtzqcYXisUGBmKJhMuw6MXRFiQBArXAiBVL6cramXyfme917Jcip0IBnn28WAAsqVw86/MqDU64w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22137},"main":"./index.ts","type":"module","module":"index.ts","shasum":"eff9227ad419bdffb4c55f4872e283f0ea4184da","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:cabinet-workshop":"bun ./example/cabinet-workshop.ts","example:compression-arena":"bun ./example/compression-arena.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-jDiYzNJlbef0572BbbLkyeMO9eaEEoYACt70AV/oMPiSNG1dEiaPGuM3qyaZaVoUF8fG/3LRfegQK9pU7XKMYw==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/cabinet"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 CABINET bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@bun-win32/kernel32":"1.0.25"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/cabinet_1.0.1_1780581899778_0.15174359541643412","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@bun-win32/cabinet","version":"1.0.2","keywords":["bun","ffi","win32","windows","cabinet","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/cabinet@1.0.2","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"35614cd1dad0f0c24fd13dabd2374d1746c71bb2","tarball":"https://registry.npmjs.org/@bun-win32/cabinet/-/cabinet-1.0.2.tgz","fileCount":6,"integrity":"sha512-r0E4a0+wRjnMz1sU688qMw+ZPCoPdlt0Tn5B7Q1MWvyWZulp0uWd7+emr9rZDLTlm0PbSf4Azi1QxBfkGb5xFQ==","signatures":[{"sig":"MEYCIQDOX8Oc+FQkxTlxhXg4rL4RJqnOzDFkLMdBc0sMTuVPtwIhAJMO6HlJUnvOidRm+/ko8ikkvZlm7iCoy/mV3/8o6S40","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22142},"main":"./index.ts","type":"module","module":"index.ts","shasum":"35614cd1dad0f0c24fd13dabd2374d1746c71bb2","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:cabinet-workshop":"bun ./example/cabinet-workshop.ts","example:compression-arena":"bun ./example/compression-arena.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-r0E4a0+wRjnMz1sU688qMw+ZPCoPdlt0Tn5B7Q1MWvyWZulp0uWd7+emr9rZDLTlm0PbSf4Azi1QxBfkGb5xFQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/cabinet"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 CABINET bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.4"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@bun-win32/kernel32":"1.0.26"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/cabinet_1.0.2_1781130792063_0.6373001422552389","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/cabinet","version":"2.0.0","keywords":["bun","ffi","win32","windows","cabinet","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/cabinet@2.0.0","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"ca4d1ba2f42439d1facdef32793aedc22473ce53","tarball":"https://registry.npmjs.org/@bun-win32/cabinet/-/cabinet-2.0.0.tgz","fileCount":6,"integrity":"sha512-9BCWV5VBi3sslCyWv+ZhceB0lYjVOa+jpY4X69TMHWJ4qZhof1Hb+FnjxxRdPs2M8qXTbX7vPa/T2jnEkN18ig==","signatures":[{"sig":"MEUCIQDxfOPGrHh2J2l/2CTmNJdY1GDAF8ycxMt00CKmHiLQ6AIgA/i2KE+ajzFCa8iV99TCmfPBN0g6AHbDEyWnobwiDmU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23573},"main":"./index.ts","type":"module","module":"index.ts","shasum":"ca4d1ba2f42439d1facdef32793aedc22473ce53","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:cabinet-workshop":"bun ./example/cabinet-workshop.ts","example:compression-arena":"bun ./example/compression-arena.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-9BCWV5VBi3sslCyWv+ZhceB0lYjVOa+jpY4X69TMHWJ4qZhof1Hb+FnjxxRdPs2M8qXTbX7vPa/T2jnEkN18ig==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/cabinet"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 CABINET bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"@bun-win32/core":"2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@bun-win32/kernel32":"2.0.0"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/cabinet_2.0.0_1782435272903_0.20340730397643192","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"author":"Stev Peifer <stev.p@outlook.com>","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dependencies":{"@bun-win32/core":"2.0.1"},"description":"Zero-dependency, zero-overhead Win32 CABINET bindings for Bun (FFI) on Windows.","devDependencies":{"@bun-win32/kernel32":"2.0.1","@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/cabinet","peerDependencies":{"typescript":"^5"},"private":false,"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/cabinet"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","cabinet","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:cabinet-workshop":"bun ./example/cabinet-workshop.ts","example:compression-arena":"bun ./example/compression-arena.ts"},"_id":"@bun-win32/cabinet@2.0.1","_integrity":"sha512-tgpn/DuUb6M9giYNfKwFOlzVOlS+i/049TmsvrEUV7DkH6SxMfoTC5r4RvU9VYw4YBkwNyKb/j8dm+x6oNDrsQ==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"9aa800baca0d9a9e2500cd514379bd185b737228","dist":{"integrity":"sha512-tgpn/DuUb6M9giYNfKwFOlzVOlS+i/049TmsvrEUV7DkH6SxMfoTC5r4RvU9VYw4YBkwNyKb/j8dm+x6oNDrsQ==","shasum":"9aa800baca0d9a9e2500cd514379bd185b737228","tarball":"https://registry.npmjs.org/@bun-win32/cabinet/-/cabinet-2.0.1.tgz","fileCount":6,"unpackedSize":23573,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDzWwpMgadlqhi1nNextqE+TGFEcXq67yw8wVHL95prZAiAWvXnKv3D+eB7O3A23eLnlYbMb9Yba9/dZ3riKxlSk+g=="}]},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"directories":{},"maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cabinet_2.0.1_1782437728903_0.6849348547216243"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-18T02:56:41.557Z","modified":"2026-06-26T01:35:29.152Z","1.0.0":"2026-05-18T02:56:41.848Z","1.0.1":"2026-06-04T14:04:59.923Z","1.0.2":"2026-06-10T22:33:12.205Z","2.0.0":"2026-06-26T00:54:33.036Z","2.0.1":"2026-06-26T01:35:29.022Z"},"bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","homepage":"https://github.com/ObscuritySRL/bun-win32#readme","keywords":["bun","ffi","win32","windows","cabinet","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/cabinet"},"description":"Zero-dependency, zero-overhead Win32 CABINET bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/cabinet\r\n\r\nZero-dependency, zero-overhead Win32 Cabinet bindings for [Bun](https://bun.sh) on Windows.\r\n\r\n## Overview\r\n\r\n`@bun-win32/cabinet` exposes the `cabinet.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Cabinet`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\r\n\r\nThe bindings are strongly typed for a smooth DX in TypeScript.\r\n\r\n## Features\r\n\r\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\r\n- Direct FFI to `cabinet.dll` (Compression API — MSZIP / XPRESS / XPRESS-Huffman / LZMS — plus FCI/FDI Cabinet (.cab) archive creation and extraction).\r\n- In-source docs in `structs/Cabinet.ts` with links to Microsoft Docs.\r\n- Lazy binding on first call; optional eager preload (`Cabinet.Preload()`).\r\n- No wrapper overhead; calls map 1:1 to native APIs.\r\n- Strongly-typed Win32 aliases (see `types/Cabinet.ts`).\r\n\r\n## Requirements\r\n\r\n- [Bun](https://bun.sh) runtime\r\n- Windows 10 or later\r\n\r\n## Installation\r\n\r\n```sh\r\nbun add @bun-win32/cabinet\r\n```\r\n\r\n## Quick Start\r\n\r\n```ts\r\nimport Cabinet, { COMPRESS_ALGORITHM } from '@bun-win32/cabinet';\r\n\r\nconst input = Buffer.from('compress me '.repeat(64));\r\n\r\n// Create an XPRESS-Huffman compressor (handle is returned through an out-buffer)\r\nconst hCompressor = Buffer.alloc(8);\r\nCabinet.CreateCompressor(COMPRESS_ALGORITHM.COMPRESS_ALGORITHM_XPRESS_HUFF, null, hCompressor.ptr);\r\nconst compressor = hCompressor.readBigUInt64LE(0);\r\n\r\n// Sizing call: a NULL buffer reports the required size, then compress for real\r\nconst size = Buffer.alloc(8);\r\nCabinet.Compress(compressor, input.ptr, BigInt(input.length), null, 0n, size.ptr);\r\nconst compressed = Buffer.alloc(Number(size.readBigUInt64LE(0)));\r\nCabinet.Compress(compressor, input.ptr, BigInt(input.length), compressed.ptr, BigInt(compressed.length), size.ptr);\r\nconst compressedSize = Number(size.readBigUInt64LE(0));\r\nCabinet.CloseCompressor(compressor);\r\n\r\n// Decompress back and verify the round trip\r\nconst hDecompressor = Buffer.alloc(8);\r\nCabinet.CreateDecompressor(COMPRESS_ALGORITHM.COMPRESS_ALGORITHM_XPRESS_HUFF, null, hDecompressor.ptr);\r\nconst decompressor = hDecompressor.readBigUInt64LE(0);\r\nconst restored = Buffer.alloc(input.length);\r\nCabinet.Decompress(decompressor, compressed.ptr, BigInt(compressedSize), restored.ptr, BigInt(restored.length), null);\r\nCabinet.CloseDecompressor(decompressor);\r\n\r\nconsole.log(`${input.length} → ${compressedSize} bytes · round-trip ok: ${restored.equals(input)}`);\r\n```\r\n\r\n> [!NOTE]\r\n> AI agents: see `AI.md` for the package binding contract and source-navigation guidance. It explains how to use the package without scanning the entire implementation.\r\n\r\n## Examples\r\n\r\nRun the included examples:\r\n\r\n```sh\r\n# Live algorithm race: MSZIP vs XPRESS vs XPRESS-Huffman vs LZMS, animated\r\nbun run example/compression-arena.ts\r\n\r\n# Build a real .cab with FCI, then inspect + extract + verify it with FDI\r\nbun run example/cabinet-workshop.ts\r\n```\r\n\r\n## Notes\r\n\r\n- Either rely on lazy binding or call `Cabinet.Preload()`.\r\n- Windows only. Bun runtime required.\n- **SAL types & naming:** nullability is in the **type** — `Optional<T>` (formally optional, SAL `_*opt_`) and `Nullable<T>` (plain `[in]`/`[out]` the docs say can be NULL), the null sentinel derived from `T` (`null` for pointers `LP*`/`P*`, `0n` for handles/by-value addresses); direction is in the **parameter name** — `_out` (`_Out_`), `_in_out` (`_Inout_`), `_In_` bare. See `AI.md` and the repo `AGENTS.md`.\n","readmeFilename":"README.md"}