{"_id":"@bun-win32/version","_rev":"3-772f09beaf5a1d9a35a361ab3e9ad740","name":"@bun-win32/version","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/version","version":"1.0.0","keywords":["bun","ffi","win32","windows","version","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/version@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":"c1217e1efb8bdc207c1e7564b939f2b2392ae543","tarball":"https://registry.npmjs.org/@bun-win32/version/-/version-1.0.0.tgz","fileCount":6,"integrity":"sha512-dTwkiJ0PiDp6lDd4vx+L09lMNSDxMOzmAuP3//20TA/R2A/9Vrjx3yW6qLz5HWl7x+gUVkuKW3nYN/f42VQ/rQ==","signatures":[{"sig":"MEQCIHWrdh41Cj5NYnFA+1Bg7+5TB+d9GNESmHQ/3tnhIe9KAiAOXCweV4XrKZ0WDylub42i2W8uZZBlxb2kIxrh5nyubQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18346},"main":"./index.ts","type":"module","module":"index.ts","shasum":"c1217e1efb8bdc207c1e7564b939f2b2392ae543","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:version-skyline":"bun ./example/version-skyline.ts","example:file-version-audit":"bun ./example/file-version-audit.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-dTwkiJ0PiDp6lDd4vx+L09lMNSDxMOzmAuP3//20TA/R2A/9Vrjx3yW6qLz5HWl7x+gUVkuKW3nYN/f42VQ/rQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/version"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 VERSION 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/version_1.0.0_1775700032866_0.33806159517109746","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/version","version":"2.0.0","keywords":["bun","ffi","win32","windows","version","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/version@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":"da6ac2c93f666c00d998f9900eab88da3efd528d","tarball":"https://registry.npmjs.org/@bun-win32/version/-/version-2.0.0.tgz","fileCount":6,"integrity":"sha512-LsrWZGNbU13czyUVT8FGez+v/E4RGGFt/+P87zD4+EF9uwDh4AJSlUDZBOsyM3oVUcCxOQjfv705it71vBqVEw==","signatures":[{"sig":"MEUCIQCiABvpTwyO+aCGWn0FRO3YC0r7XI7VKgCgoVNmYN3fQAIgDjcio2P3ApNJRyGp05P6HVQO1QBZwKA+i0aLcJZMP54=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19854},"main":"./index.ts","type":"module","module":"index.ts","shasum":"da6ac2c93f666c00d998f9900eab88da3efd528d","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:version-skyline":"bun ./example/version-skyline.ts","example:file-version-audit":"bun ./example/file-version-audit.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-LsrWZGNbU13czyUVT8FGez+v/E4RGGFt/+P87zD4+EF9uwDh4AJSlUDZBOsyM3oVUcCxOQjfv705it71vBqVEw==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/version"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 VERSION 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/version_2.0.0_1782435977805_0.424113240719713","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 VERSION 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/version","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/version"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","version","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:file-version-audit":"bun ./example/file-version-audit.ts","example:version-skyline":"bun ./example/version-skyline.ts"},"_id":"@bun-win32/version@2.0.1","_integrity":"sha512-2j25zd0k64hEQ7P6zIU4Ev4VnZ1NgQ7goSptqj89IMM7z3xwsYy4Q9wJwko8tXqhI1aNu1UMEwUR9B2mt+k8rA==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"00d23dc6f8a766a302216937ad5a0cc06970c82c","dist":{"integrity":"sha512-2j25zd0k64hEQ7P6zIU4Ev4VnZ1NgQ7goSptqj89IMM7z3xwsYy4Q9wJwko8tXqhI1aNu1UMEwUR9B2mt+k8rA==","shasum":"00d23dc6f8a766a302216937ad5a0cc06970c82c","tarball":"https://registry.npmjs.org/@bun-win32/version/-/version-2.0.1.tgz","fileCount":6,"unpackedSize":19854,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDXNZY5H2R96HtvRryJKg6LHjq49zMuHTTt14zUAEaCwAIgZ/YKaq5eiSM3mSekAGunAp/1daxM1mX3iv+8Utb0VyI="}]},"_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/version_2.0.1_1782438203794_0.19513083012698873"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-09T02:00:32.803Z","modified":"2026-06-26T01:43:24.046Z","1.0.0":"2026-04-09T02:00:33.015Z","2.0.0":"2026-06-26T01:06:17.931Z","2.0.1":"2026-06-26T01:43:23.932Z"},"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","version","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/version"},"description":"Zero-dependency, zero-overhead Win32 VERSION bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/version\n\nZero-dependency, zero-overhead Win32 Version bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/version` exposes the `version.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Version`, 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 `version.dll` (file version resources, translation tables, and installer helpers).\n- In-source docs in `structs/Version.ts` with links to Microsoft Docs.\n- Lazy binding on first call; optional eager preload (`Version.Preload()`).\n- No wrapper overhead; calls map 1:1 to native APIs.\n- Strongly-typed Win32 aliases (see `types/Version.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/version\n```\n\n## Quick Start\n\n```ts\nimport { read, toArrayBuffer } from 'bun:ffi';\n\nimport Version from '@bun-win32/version';\n\nVersion.Preload(['GetFileVersionInfoSizeW', 'GetFileVersionInfoW', 'VerQueryValueW']);\n\nconst filePath = Buffer.from(process.execPath + '\\0', 'utf16le');\nconst versionInfoSize = Version.GetFileVersionInfoSizeW(filePath.ptr, null);\n\nif (versionInfoSize === 0) {\n  throw new Error('GetFileVersionInfoSizeW failed');\n}\n\nconst versionInfoBuffer = Buffer.alloc(versionInfoSize);\nconst loaded = Version.GetFileVersionInfoW(filePath.ptr, 0, versionInfoSize, versionInfoBuffer.ptr);\n\nif (loaded === 0) {\n  throw new Error('GetFileVersionInfoW failed');\n}\n\nconst fixedInfoPointerBuffer = Buffer.alloc(8);\nconst fixedInfoLengthBuffer = Buffer.alloc(4);\nconst rootSubBlock = Buffer.from('\\\\\\0', 'utf16le');\nconst queried = Version.VerQueryValueW(versionInfoBuffer.ptr, rootSubBlock.ptr, fixedInfoPointerBuffer.ptr, fixedInfoLengthBuffer.ptr);\n\nif (queried === 0) {\n  throw new Error('VerQueryValueW failed');\n}\n\nconst fixedInfoPointer = read.ptr(fixedInfoPointerBuffer.ptr);\n\nif (fixedInfoPointer === null) {\n  throw new Error('VerQueryValueW returned a null pointer');\n}\n\nconst fixedInfoBuffer = Buffer.from(toArrayBuffer(fixedInfoPointer, 0, fixedInfoLengthBuffer.readUInt32LE(0)));\nconst fileVersionMajor = fixedInfoBuffer.readUInt16LE(10);\nconst fileVersionMinor = fixedInfoBuffer.readUInt16LE(8);\nconst fileVersionBuild = fixedInfoBuffer.readUInt16LE(14);\nconst fileVersionRevision = fixedInfoBuffer.readUInt16LE(12);\n\nconsole.log(`Version resource: ${fileVersionMajor}.${fileVersionMinor}.${fileVersionBuild}.${fileVersionRevision}`);\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:file-version-audit\nbun run example:version-skyline\n```\n\n## Notes\n\n- Either rely on lazy binding or call `Version.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"}