2
2
-- This file is auto-generated from README_js.md. Changes should be made there.
3
3
-->
4
4
5
+
5
6
# uuid [ ![ CI] ( https://github.com/uuidjs/uuid/workflows/CI/badge.svg )] ( https://github.com/uuidjs/uuid/actions?query=workflow%3ACI ) [ ![ Browser] ( https://github.com/uuidjs/uuid/workflows/Browser/badge.svg )] ( https://github.com/uuidjs/uuid/actions?query=workflow%3ABrowser )
6
7
7
8
For the creation of [ RFC9562] ( https://www.rfc-editor.org/rfc/rfc9562.html ) (formally [ RFC4122] ( https://www.rfc-editor.org/rfc/rfc4122.html ) ) UUIDs
8
9
9
- - ** Complete** - Support for all RFC9562 UUID versions
10
+ - ** Complete** - Support for all RFC9562 (nee RFC4122) UUID versions
10
11
- ** Cross-platform** - Support for ...
11
12
- CommonJS, [ ECMAScript Modules] ( #ecmascript-modules ) and [ CDN builds] ( #cdn-builds )
12
13
- NodeJS 16+ ([ LTS releases] ( https://github.com/nodejs/Release ) )
@@ -60,10 +61,13 @@ For timestamp UUIDs, namespace UUIDs, and other options read on ...
60
61
| [ ` uuid.parse() ` ] ( #uuidparsestr ) | Convert UUID string to array of bytes | New in ` uuid@8.3 ` |
61
62
| [ ` uuid.stringify() ` ] ( #uuidstringifyarr-offset ) | Convert array of bytes to UUID string | New in ` uuid@8.3 ` |
62
63
| [ ` uuid.v1() ` ] ( #uuidv1options-buffer-offset ) | Create a version 1 (timestamp) UUID | |
64
+ | [ ` uuid.v1ToV6() ` ] ( #uuidv1tov6uuid ) | Create a version 6 UUID from a version 1 UUID | New in ` uuid@10 ` |
63
65
| [ ` uuid.v3() ` ] ( #uuidv3name-namespace-buffer-offset ) | Create a version 3 (namespace w/ MD5) UUID | |
64
66
| [ ` uuid.v4() ` ] ( #uuidv4options-buffer-offset ) | Create a version 4 (random) UUID | |
65
67
| [ ` uuid.v5() ` ] ( #uuidv5name-namespace-buffer-offset ) | Create a version 5 (namespace w/ SHA-1) UUID | |
66
- | [ ` uuid.v7() ` ] ( #uuidv7options-buffer-offset ) | Create a version 7 (Unix Epoch time-based) UUID | ` experimental support ` |
68
+ | [ ` uuid.v6() ` ] ( #uuidv6options-buffer-offset ) | Create a version 6 (timestamp, reordered) UUID | New in ` uuid@10 ` |
69
+ | [ ` uuid.v6ToV1() ` ] ( #uuidv6tov1uuid ) | Create a version 1 UUID from a version 6 UUID | New in ` uuid@10 ` |
70
+ | [ ` uuid.v7() ` ] ( #uuidv7options-buffer-offset ) | Create a version 7 (Unix Epoch time-based) UUID | New in ` uuid@10 ` |
67
71
| [ ` uuid.validate() ` ] ( #uuidvalidatestr ) | Test a string to see if it is a valid UUID | New in ` uuid@8.3 ` |
68
72
| [ ` uuid.version() ` ] ( #uuidversionstr ) | Detect RFC version of a UUID | New in ` uuid@8.3 ` |
69
73
@@ -191,13 +195,23 @@ Example using `options`:
191
195
``` javascript
192
196
import { v1 as uuidv1 } from ' uuid' ;
193
197
194
- const v1options = {
198
+ const options = {
195
199
node: [0x01 , 0x23 , 0x45 , 0x67 , 0x89 , 0xab ],
196
200
clockseq: 0x1234 ,
197
201
msecs: new Date (' 2011-11-01' ).getTime (),
198
202
nsecs: 5678 ,
199
203
};
200
- uuidv1 (v1options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab'
204
+ uuidv1 (options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab'
205
+ ```
206
+
207
+ ### uuid.v1ToV6(uuid)
208
+
209
+ Convert a UUID from version 1 to version 6
210
+
211
+ ``` javascript
212
+ import { v1ToV6 } from ' uuid' ;
213
+
214
+ v1ToV6 (' 92f62d9e-22c4-11ef-97e9-325096b39f47' ); // ⇨ '1ef22c49-2f62-6d9e-97e9-325096b39f47'
201
215
```
202
216
203
217
### uuid.v3(name, namespace[ , buffer[ , offset]] )
@@ -280,6 +294,42 @@ import { v5 as uuidv5 } from 'uuid';
280
294
uuidv5 (' https://www.w3.org/' , uuidv5 .URL ); // ⇨ 'c106a26a-21bb-5538-8bf2-57095d1976c1'
281
295
```
282
296
297
+ ### uuid.v6([ options[ , buffer[ , offset]]] )
298
+
299
+ Create an RFC version 6 (timestamp, reordered) UUID
300
+
301
+ This method takes the same arguments as uuid.v1().
302
+
303
+ ``` javascript
304
+ import { v6 as uuidv6 } from ' uuid' ;
305
+
306
+ uuidv6 (); // ⇨ '1e940672-c5ea-64c0-8bad-9b1deb4d3b7d'
307
+ ```
308
+
309
+ Example using ` options ` :
310
+
311
+ ``` javascript
312
+ import { v6 as uuidv6 } from ' uuid' ;
313
+
314
+ const options = {
315
+ node: [0x01 , 0x23 , 0x45 , 0x67 , 0x89 , 0xab ],
316
+ clockseq: 0x1234 ,
317
+ msecs: new Date (' 2011-11-01' ).getTime (),
318
+ nsecs: 5678 ,
319
+ };
320
+ uuidv6 (options); // ⇨ '1e1041c7-10b9-662e-9234-0123456789ab'
321
+ ```
322
+
323
+ ### uuid.v6ToV1(uuid)
324
+
325
+ Convert a UUID from version 6 to version 1
326
+
327
+ ``` javascript
328
+ import { v6ToV1 } from ' uuid' ;
329
+
330
+ v6ToV1 (' 1ef22c49-2f62-6d9e-97e9-325096b39f47' ); // ⇨ '92f62d9e-22c4-11ef-97e9-325096b39f47'
331
+ ```
332
+
283
333
### uuid.v7([ options[ , buffer[ , offset]]] )
284
334
285
335
Create an RFC version 7 (random) UUID
@@ -300,7 +350,7 @@ Example:
300
350
``` javascript
301
351
import { v7 as uuidv7 } from ' uuid' ;
302
352
303
- uuidv7 (); // ⇨ '01695553-c90c-7aad-9bdd-330d7b3dcb6d '
353
+ uuidv7 (); // ⇨ '01695553-c90c-722d-9b5d-b38dfbbd4bed '
304
354
```
305
355
306
356
### uuid.validate(str)
@@ -520,5 +570,6 @@ const uuid = require('uuid'); // <== REMOVED!
520
570
521
571
This usage pattern was already discouraged in ` uuid@3 ` and has been removed in ` uuid@7 ` .
522
572
523
- ----
524
- Markdown generated from [ README_js.md] ( README_js.md ) by [ ![ RunMD Logo] ( https://i.imgur.com/h0FVyzU.png )] ( https://github.com/broofa/runmd )
573
+ ---
574
+
575
+ Markdown generated from [ README_js.md] ( README_js.md ) by <a href =" https://github.com/broofa/runmd " ><image height =" 12px " src =" https://camo.githubusercontent.com/5c7c603cd1e6a43370b0a5063d457e0dabb74cf317adc7baba183acb686ee8d0/687474703a2f2f692e696d6775722e636f6d2f634a4b6f3662552e706e67 " /></a >
0 commit comments