Small, dependency-free utility for working with Windows / CFBF GUIDs in JavaScript and TypeScript.
It parses canonical GUID strings into the Windows byte layout used by COM, OLE, and Compound File Binary Format (CFBF), and converts them back to the standard string form when needed.
This is useful when dealing with Microsoft file formats such as .asf, .doc,, .xls, .ppt, structured storage,
or other binary formats that store GUIDs in little-endian Windows order.
For RFC9562 compliant UUIDs (network byte order), use uuid instead.
npm install win-guidimport { parseWindowsGuid } from "win-guid";
const bytes = parseWindowsGuid("00020906-0000-0000-C000-000000000046");
// Uint8Array(16) in Windows / CFBF byte orderimport { Guid } from "win-guid";
const guid = Guid.fromString("00020906-0000-0000-C000-000000000046");parseWindowsGuid(guid: string): Uint8Array
Parses a canonical GUID string:
const bytes = parseWindowsGuid("00020906-0000-0000-C000-000000000046");into a 16-byte Uint8Array using Windows / CFBF byte order.
- Input is validated strictly
- Case-insensitive
- Throws Error on invalid input
class Guid
Creates a GUID from a canonical GUID string.
const guid = Guid.fromString("00020906-0000-0000-C000-000000000046");guid.toString(): string
Converts the GUID back into the canonical string form.
- Always uppercase
- Round-trips cleanly with fromString
guid.toString();Outputs something like:
00020906-0000-0000-C000-000000000046`
This project is licensed under the MIT License. Feel free to use, modify, and distribute as needed.