`offset` - (Number) Starting index in `buffer` at which to begin writing. `namespace` - (String | Array) "namespace" UUID either as a String or Array of byte values `name` - (String | Array) "name" to create UUID with Generate and return a RFC4122 version 5 UUID. Note: The default ( ) (the last 12 digits in the UUID) is generated once, randomly, on process startup, and then remains unchanged for the duration of the process.Įxample: Generate string UUID with fully-specified options `random` - (Number) Array of 16 numbers (0-255) to use for initialization of `node` and `clockseq` as described above. Default: internal uuid counter is used, as per 4.2.1.2. `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. `msecs` - (Number) Time in milliseconds since unix Epoch. Default: An internally maintained clockseq is used. `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Generate and return a RFC4122 version 1 (timestamp) UUID. Returns `buffer`, if specified, otherwise the string form of the UUIDĮxample: Generate string UUID with predefined `random` values `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. `rng` - (Function) Random # generator function that returns an Array of byte values (0-255). `random` - (Number) Array of 16 numbers (0-255) to use in place of randomly generated values. `options` - (Object) Optional uuid state to apply. Generate and return a RFC4122 version 4 UUID. Using a custom namespace (See note, above, about generating your ownĬonst MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341' Using predefined URL namespace (for URLs) Using predefined DNS namespace (for domain names) ⚠ ️ If using a custom namespace **be sure to generate your own Note that per the RFC, "_If backwardĬompatibility is not an issue, SHA-1 is preferred_." ⚠ ️ Version 3 and Version 5 UUIDs are basically the same, differing # Create Version 3 or Version 5 (Namespace) UUIDs **Unsure which one to use?** Use version 4 (random) unless you have a specific need for one of the other versions. Version 3 (namespace, MD5) - Like version 5, above, but with a poorer hash algorithm Version 5 (namespace, SHA-1) - Created from user-supplied name and namespace strings Version 1 (timestamp) - Created from the system clock (plus random values) Version 4 (random) - Created from cryptographically-strong random values Versions, all of which are supported here. Once installed, decide which type of UUID you need. **Upgrading from Your code is probably okay, but check out [Upgrading **CLI** - Includes the ( #command-line) utility **Small** - Zero-dependency, small footprint, plays nice with "tree shaking" packagers **Secure** - Cryptographically-strong random values Chrome, Safari, Firefox, Edge, IE 11 browsers CommonJS, ( #ecmascript-modules) and UMD builds **Complete** - Support for RFC4122 version 1, 3, 4, and 5 UUIDs
0 Comments
Leave a Reply. |