win-guid is a JavaScript/TypeScript module designed for encoding and decoding Windows legacy GUIDs, which adhere to a mixed-endianness byte layout distinct from RFC 9562 UUIDs. This format is crucial when working with various Microsoft and firmware standards, including COM, OLE, CFBF (Structured Storage), GPT, UEFI, Windows Registry, and Active Directory objectGUID values. The package provides utilities to parse canonical GUID strings into `Uint8Array`s and a `Guid` helper class for object-oriented manipulation. The current stable version is 0.2.1, with recent updates focusing on minor bug fixes and documentation improvements. It explicitly differentiates itself from RFC 9562 UUID libraries (like `uuidjs/uuid`) by handling the specific Windows byte order reordering in the first three fields, making it indispensable for interoperability with binary Microsoft formats.
npm install win-guidVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing a Windows legacy GUID string into a byte array, creating a `Guid` object, accessing its bytes, and converting it back to a string.
Ensure your environment is set up for ESM imports (e.g., `type: module` in `package.json`, `.mjs` files) or use dynamic `import()` for CommonJS contexts. If encountering issues, verify bundler configuration for ESM compatibility.
Always be mindful of the byte order when converting to or from other UUID/GUID representations. If working with RFC 9562 compliant UUIDs (e.g., for standard HTTP headers), use a library like `uuid` instead of `win-guid`. This library is for specific Windows binary formats.
Ensure all input GUID strings adhere to the strict canonical format. Pre-process or validate input strings if they might come in non-standard formats (e.g., with braces, different separators, or incorrect lengths).
Check the input string for correct hyphen placement, hexadecimal character validity, and length. It must be `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`.
For ESM, use `import { Guid } from 'win-guid';`. For CommonJS, after v0.2.1, it's generally recommended to use dynamic `import()` for ESM-first packages or ensure your bundler properly transpiles. If directly `require`ing, access named exports: `const { Guid } = require('win-guid');`.Remember that `win-guid` specifically implements the mixed-endian Windows byte order. If you're comparing against a standard UUID, ensure you're accounting for the byte reordering in the first 8 bytes (Data1, Data2, Data3) or convert the `win-guid` output to RFC 9562 order manually if necessary for specific comparisons.
No dependency data recorded yet.