{"_id":"@bun-win32/virtdisk","_rev":"4-822905055e5c257b809031b5f7ca2a43","name":"@bun-win32/virtdisk","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/virtdisk","version":"1.0.0","keywords":["bun","ffi","win32","windows","virtdisk","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/virtdisk@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":"d9581a8a796a3c6e72af614162cf5b3d9262089f","tarball":"https://registry.npmjs.org/@bun-win32/virtdisk/-/virtdisk-1.0.0.tgz","fileCount":6,"integrity":"sha512-rIlp2C8CFU4nxe6iw9O3leD0ebUJriMdd7xPaViW+NiP2/qBvmD/zHTAyWm+zqUbhUHTh7PYnsT/U5S/uc2aAw==","signatures":[{"sig":"MEUCIQCh8boY16ZB9WvXB4FPOGylTpH9Rrj4UbgqYzVtvinBKgIgZ1mJDVG/oVXBtlcd5sMpFVLXgJRHtzwVkgKY/9ZK2EY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33405},"main":"./index.ts","type":"module","module":"index.ts","shasum":"d9581a8a796a3c6e72af614162cf5b3d9262089f","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:vhd-forge":"bun ./example/vhd-forge.ts","example:disk-inspector":"bun ./example/disk-inspector.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-rIlp2C8CFU4nxe6iw9O3leD0ebUJriMdd7xPaViW+NiP2/qBvmD/zHTAyWm+zqUbhUHTh7PYnsT/U5S/uc2aAw==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/virtdisk"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 VIRTDISK bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2","@bun-win32/kernel32":"1.0.21"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/virtdisk_1.0.0_1775852925881_0.729544223695133","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bun-win32/virtdisk","version":"1.0.1","keywords":["bun","ffi","win32","windows","virtdisk","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/virtdisk@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":"fe308e2e85e0e90a4e137faa46003a94f2a9f0c3","tarball":"https://registry.npmjs.org/@bun-win32/virtdisk/-/virtdisk-1.0.1.tgz","fileCount":6,"integrity":"sha512-O2Qk7AYQ221rzII2oxfdRq1AN6lYH/QD6sf0oR/QMvxXA55xN5B3CFUsVyYFEhaEf3bpu2BFgzN8mT/C/6EVLQ==","signatures":[{"sig":"MEYCIQDxcbQNQ4WLjrdwqzrMKAMXTfBUMl/Hu+0UhA6A2EWupAIhAKMsNhrk12fCWUNbUOPafR3mxzUR9gmK7hukWugZcQwL","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33405},"main":"./index.ts","type":"module","module":"index.ts","shasum":"fe308e2e85e0e90a4e137faa46003a94f2a9f0c3","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:vhd-forge":"bun ./example/vhd-forge.ts","example:disk-inspector":"bun ./example/disk-inspector.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-O2Qk7AYQ221rzII2oxfdRq1AN6lYH/QD6sf0oR/QMvxXA55xN5B3CFUsVyYFEhaEf3bpu2BFgzN8mT/C/6EVLQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/virtdisk"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 VIRTDISK bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2","@bun-win32/kernel32":"1.0.25"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/virtdisk_1.0.1_1780581934613_0.10455443390914176","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/virtdisk","version":"2.0.0","keywords":["bun","ffi","win32","windows","virtdisk","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/virtdisk@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":"50294fdbcb344f973cf93ab5958a56370b431e11","tarball":"https://registry.npmjs.org/@bun-win32/virtdisk/-/virtdisk-2.0.0.tgz","fileCount":6,"integrity":"sha512-fqNpnI3BfFHAsoctvXRoftXe2Ae3oMP5dROhNRD76YNjEtjlA4P7MTIqDlu+8nE01JLq05q181hy1A4CjJnQVw==","signatures":[{"sig":"MEQCIHuJNHeAlzERvHiUqHrzGjgplYycKePp5LeaBOsJ+BDDAiAN4xZ37jqEfl25RR9slDfAUqMXZ9gMzuhxO1TTkr89zA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":35077},"main":"./index.ts","type":"module","module":"index.ts","shasum":"50294fdbcb344f973cf93ab5958a56370b431e11","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:vhd-forge":"bun ./example/vhd-forge.ts","example:disk-inspector":"bun ./example/disk-inspector.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-fqNpnI3BfFHAsoctvXRoftXe2Ae3oMP5dROhNRD76YNjEtjlA4P7MTIqDlu+8nE01JLq05q181hy1A4CjJnQVw==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/virtdisk"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 VIRTDISK bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"@bun-win32/core":"2.0.0","@bun-win32/kernel32":"2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/virtdisk_2.0.0_1782435979740_0.3337061097428631","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","@bun-win32/kernel32":"2.0.1"},"description":"Zero-dependency, zero-overhead Win32 VIRTDISK bindings for Bun (FFI) on Windows.","devDependencies":{"@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/virtdisk","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/virtdisk"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","virtdisk","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:vhd-forge":"bun ./example/vhd-forge.ts","example:disk-inspector":"bun ./example/disk-inspector.ts"},"_id":"@bun-win32/virtdisk@2.0.1","_integrity":"sha512-KqLdXJTCQ2r96/FL8mazzekGBNNYEu9PhPLnomTgvSCMGUKusg9WbgbFZUpRud/la7WdjkV4d2ZUExKUmoUorw==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"1e66b5ae8d19ef935cdfc4b12e26843ec35d2192","dist":{"integrity":"sha512-KqLdXJTCQ2r96/FL8mazzekGBNNYEu9PhPLnomTgvSCMGUKusg9WbgbFZUpRud/la7WdjkV4d2ZUExKUmoUorw==","shasum":"1e66b5ae8d19ef935cdfc4b12e26843ec35d2192","tarball":"https://registry.npmjs.org/@bun-win32/virtdisk/-/virtdisk-2.0.1.tgz","fileCount":6,"unpackedSize":35077,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDFxZ7+PGV3IjAvNJCtBJ9h4+qsRopOzshG8Gwqzna4nAiAu766gSrPMM5bJqBLx8Gdq8icEAwslMoMiMJgAZ+TGjQ=="}]},"_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/virtdisk_2.0.1_1782438205164_0.7617616778037835"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-10T20:28:45.809Z","modified":"2026-06-26T01:43:25.426Z","1.0.0":"2026-04-10T20:28:46.029Z","1.0.1":"2026-06-04T14:05:34.896Z","2.0.0":"2026-06-26T01:06:19.872Z","2.0.1":"2026-06-26T01:43:25.291Z"},"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","virtdisk","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/virtdisk"},"description":"Zero-dependency, zero-overhead Win32 VIRTDISK bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/virtdisk\n\nZero-dependency, zero-overhead Win32 Virtdisk bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/virtdisk` exposes the `virtdisk.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Virtdisk`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\n\nThe bindings are strongly typed for a smooth DX in TypeScript.\n\n## Features\n\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\n- Direct FFI to `virtdisk.dll` (VHD, VHDX, and ISO virtual disk management).\n- In-source docs in `structs/Virtdisk.ts` with links to Microsoft Docs.\n- Lazy binding on first call; optional eager preload (`Virtdisk.Preload()`).\n- No wrapper overhead; calls map 1:1 to native APIs.\n- Strongly-typed Win32 aliases (see `types/Virtdisk.ts`).\n\n## Requirements\n\n- [Bun](https://bun.sh) runtime\n- Windows 10 or later\n\n## Installation\n\n```sh\nbun add @bun-win32/virtdisk\n```\n\n## Quick Start\n\n```ts\nimport Virtdisk, {\n  CREATE_VIRTUAL_DISK_FLAG,\n  CREATE_VIRTUAL_DISK_VERSION,\n  VIRTUAL_DISK_ACCESS_MASK,\n  VIRTUAL_STORAGE_TYPE_DEVICE_VHDX,\n} from '@bun-win32/virtdisk';\n\n// Build VIRTUAL_STORAGE_TYPE for VHDX (Microsoft vendor)\nconst storageType = Buffer.alloc(20);\nstorageType.writeUInt32LE(VIRTUAL_STORAGE_TYPE_DEVICE_VHDX, 0);\nstorageType.writeUInt32LE(0xec984aec, 4);   // VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT\nstorageType.writeUInt16LE(0xa0f9, 8);\nstorageType.writeUInt16LE(0x47e9, 10);\nstorageType.set([0x90, 0x1f, 0x71, 0x41, 0x5a, 0x66, 0x34, 0x5b], 12);\n\n// Build CREATE_VIRTUAL_DISK_PARAMETERS Version1 (64 MB)\nconst params = Buffer.alloc(56);\nparams.writeUInt32LE(CREATE_VIRTUAL_DISK_VERSION.CREATE_VIRTUAL_DISK_VERSION_1, 0);\nparams.writeBigUInt64LE(64n * 1024n * 1024n, 24);\n\nconst path = Buffer.from('C:\\\\temp\\\\test.vhdx\\0', 'utf16le');\nconst handle = Buffer.alloc(8);\n\nconst result = Virtdisk.CreateVirtualDisk(\n  storageType.ptr!, path.ptr!,\n  VIRTUAL_DISK_ACCESS_MASK.VIRTUAL_DISK_ACCESS_CREATE, null,\n  CREATE_VIRTUAL_DISK_FLAG.CREATE_VIRTUAL_DISK_FLAG_NONE, 0,\n  params.ptr!, null, handle.ptr!,\n);\n\nconsole.log(result === 0 ? 'Created' : `Error: ${result}`);\n```\n\n> [!NOTE]\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.\n\n## Examples\n\nRun the included examples:\n\n```sh\nbun run example:vhd-forge\nbun run example:disk-inspector\n```\n\n## Notes\n\n- Either rely on lazy binding or call `Virtdisk.Preload()`.\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"}