win-guid 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -8
- package/lib/guid.d.ts +1 -1
- package/package.json +48 -48
package/README.md
CHANGED
|
@@ -4,14 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
# win-guid
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A module for decoding and encoding Windows GUIDs in the **Windows GUID byte layout** used by COM, OLE, and Compound File Binary Format (CFBF), and converting them back to the canonical string form when needed.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
This is useful when dealing with Microsoft file formats such as `.asf`, `.doc`, `.xls`, `.ppt`, OLE/COM Structured Storage (CFBF), or other binary formats that store GUIDs in Windows order.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
or other binary formats that store GUIDs in little-endian Windows order.
|
|
11
|
+
## Windows GUID byte layout vs RFC 9562 UUID byte layout
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
The table below shows how GUID `00112233-4455-6677-8899-AABBCCDDEEFF` is serialized as an [RFC 9562](https://www.rfc-editor.org/rfc/rfc9562.html) UUID versus a Windows GUID:
|
|
14
|
+
|
|
15
|
+
| UUID / GUID type | Serialized byte layout (hexadecimal) |
|
|
16
|
+
|-------------------------|---------------------------------------------------|
|
|
17
|
+
| RFC 9562 UUID layout | `00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF` |
|
|
18
|
+
| Windows GUID layout | `33 22 11 00 55 44 77 66 88 99 AA BB CC DD EE FF` |
|
|
19
|
+
|
|
20
|
+
Windows GUID layout reorders only the first three fields (32-bit, 16-bit, 16-bit). The remaining 8 bytes are stored as-is.
|
|
21
|
+
|
|
22
|
+
For RFC 9562 compliant UUIDs (network byte order), use [uuid](https://github.com/uuidjs/uuid) instead.
|
|
15
23
|
|
|
16
24
|
## Installation
|
|
17
25
|
|
|
@@ -28,7 +36,7 @@ import { parseWindowsGuid } from "win-guid";
|
|
|
28
36
|
|
|
29
37
|
const bytes = parseWindowsGuid("00020906-0000-0000-C000-000000000046");
|
|
30
38
|
|
|
31
|
-
// Uint8Array(16) in Windows
|
|
39
|
+
// Uint8Array(16) in Windows GUID byte order
|
|
32
40
|
```
|
|
33
41
|
|
|
34
42
|
### Use the Guid helper class
|
|
@@ -48,7 +56,7 @@ Parses a canonical GUID string:
|
|
|
48
56
|
const bytes = parseWindowsGuid("00020906-0000-0000-C000-000000000046");
|
|
49
57
|
```
|
|
50
58
|
|
|
51
|
-
into a 16-byte Uint8Array using Windows
|
|
59
|
+
into a 16-byte `Uint8Array` using Windows GUID byte order.
|
|
52
60
|
|
|
53
61
|
- Input is validated strictly
|
|
54
62
|
- Case-insensitive
|
|
@@ -71,14 +79,23 @@ Converts the GUID back into the canonical string form.
|
|
|
71
79
|
|
|
72
80
|
```js
|
|
73
81
|
guid.toString();
|
|
74
|
-
|
|
82
|
+
```
|
|
75
83
|
Outputs something like:
|
|
76
84
|
```
|
|
77
85
|
00020906-0000-0000-C000-000000000046`
|
|
78
86
|
```
|
|
79
87
|
|
|
88
|
+
`guid.bytes: Uint8Array`
|
|
80
89
|
|
|
90
|
+
Provides access to the raw 16-byte GUID in Windows / CFBF byte order.
|
|
81
91
|
|
|
92
|
+
Notes:
|
|
93
|
+
- The returned value is a `Uint8Array(16)`
|
|
94
|
+
- It represents the Windows GUID byte layout (as stored in COM, OLE, CFBF, and related formats)
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
const bytes = guid.bytes;
|
|
98
|
+
```
|
|
82
99
|
|
|
83
100
|
## Licence
|
|
84
101
|
|
package/lib/guid.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "win-guid",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Windows GUID",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"exports": "./lib/guid.js",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"clean": "del-cli 'lib/**/*.js' 'lib/**/*.js.map' 'lib/**/*.d.ts' 'src/**/*.d.ts'",
|
|
9
|
-
"compile-src": "tsc -p lib",
|
|
10
|
-
"compile": "yarn run compile-src",
|
|
11
|
-
"format": "biome format",
|
|
12
|
-
"lint:ts": "biome check",
|
|
13
|
-
"build": "yarn run clean && yarn run compile",
|
|
14
|
-
"test": "mocha",
|
|
15
|
-
"prepublishOnly": "yarn run build",
|
|
16
|
-
"update-biome": "yarn add -D --exact @biomejs/biome && npx @biomejs/biome migrate --write"
|
|
17
|
-
},
|
|
18
|
-
"files": [
|
|
19
|
-
"lib/**/*.js",
|
|
20
|
-
"lib/**/*.d.ts",
|
|
21
|
-
"lib/*.cjs"
|
|
22
|
-
],
|
|
23
|
-
"author": {
|
|
24
|
-
"name": "Borewit",
|
|
25
|
-
"url": "https://github.com/Borewit"
|
|
26
|
-
},
|
|
27
|
-
"repository": {
|
|
28
|
-
"type": "git",
|
|
29
|
-
"url": "git+https://github.com/Borewit/win-guid.git"
|
|
30
|
-
},
|
|
31
|
-
"license": "MIT",
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"@types/chai": "^5.2.3",
|
|
34
|
-
"@types/mocha": "^10.0.10",
|
|
35
|
-
"biome": "^0.3.3",
|
|
36
|
-
"chai": "^6.2.2",
|
|
37
|
-
"del-cli": "^7.0.0",
|
|
38
|
-
"mocha": "^11.7.5",
|
|
39
|
-
"typescript": "^5.9.3"
|
|
40
|
-
},
|
|
41
|
-
"main": "index.js",
|
|
42
|
-
"packageManager": "yarn@4.9.1",
|
|
43
|
-
"keywords": [
|
|
44
|
-
"GUID",
|
|
45
|
-
"Windows",
|
|
46
|
-
"COM"
|
|
47
|
-
]
|
|
48
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "win-guid",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Windows GUID",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": "./lib/guid.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"clean": "del-cli 'lib/**/*.js' 'lib/**/*.js.map' 'lib/**/*.d.ts' 'src/**/*.d.ts'",
|
|
9
|
+
"compile-src": "tsc -p lib",
|
|
10
|
+
"compile": "yarn run compile-src",
|
|
11
|
+
"format": "biome format",
|
|
12
|
+
"lint:ts": "biome check",
|
|
13
|
+
"build": "yarn run clean && yarn run compile",
|
|
14
|
+
"test": "mocha",
|
|
15
|
+
"prepublishOnly": "yarn run build",
|
|
16
|
+
"update-biome": "yarn add -D --exact @biomejs/biome && npx @biomejs/biome migrate --write"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"lib/**/*.js",
|
|
20
|
+
"lib/**/*.d.ts",
|
|
21
|
+
"lib/*.cjs"
|
|
22
|
+
],
|
|
23
|
+
"author": {
|
|
24
|
+
"name": "Borewit",
|
|
25
|
+
"url": "https://github.com/Borewit"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/Borewit/win-guid.git"
|
|
30
|
+
},
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/chai": "^5.2.3",
|
|
34
|
+
"@types/mocha": "^10.0.10",
|
|
35
|
+
"biome": "^0.3.3",
|
|
36
|
+
"chai": "^6.2.2",
|
|
37
|
+
"del-cli": "^7.0.0",
|
|
38
|
+
"mocha": "^11.7.5",
|
|
39
|
+
"typescript": "^5.9.3"
|
|
40
|
+
},
|
|
41
|
+
"main": "index.js",
|
|
42
|
+
"packageManager": "yarn@4.9.1",
|
|
43
|
+
"keywords": [
|
|
44
|
+
"GUID",
|
|
45
|
+
"Windows",
|
|
46
|
+
"COM"
|
|
47
|
+
]
|
|
48
|
+
}
|