![]() Set to one of the built-in generators - uuid.mathRNG (all platforms), uuid.nodeRNG (node.js only), uuid.whatwgRNG (WebKit only) - or a custom function that returns an array of byte values. Node.js NPM uuid Last Updated : 08 Apr, 2022 Read Discuss NPM (Node Package Manager) is a package manager of Node.js packages. rng - (Function) Random # generator to use.This means you are guaranteed to get a completely unique ID, unless you generate it from the same computer, and at the exact same time. In addition to this, it also introduces another random component just to be sure of its uniqueness. random - (Number) Array of 16 numbers (0-255) to use in place of randomly generated values UUID v1 is generated by using a combination the host computers MAC address and the current date and time. ![]() v1 ( null, arr, 16 ) // -> // Optionally use uuid.unparse() to get stringify the ids uuid. Generate two ids in an array var arr = new Array ( 32 ) // -> uuid. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.)Įxample: Generate string UUID with fully-specified options The randomly generated node id is only guaranteed to stay constant for the lifetime of the current JS runtime. Generate v1 and v4 UUIDs Universally unique identifiers are handy in many scenarios, as k6 doesn't have built-in support for UUIDs, we'll have to resort to using a Node.js library called uuid and Browserify (to make it work in k6).Cryptographically strong random generation on supporting platforms 1. Registered as a ComponentJS component ('broofa/node-uuid'). Features: Generate RFC4122 version 1 or version 4 UUIDs Runs in node.js and all browsers. Returns buffer, if specified, otherwise the string form of the UUID node-uuid Simple, fast generation of RFC4122 UUIDS. Offset - (Number) Starting index in buffer at which to begin writing. Version-1 UUIDs are generated from a time and a node ID (usually the MAC address) version-2 UUIDs are generated from an identifier (usually a group or user ID), time, and a node ID versions 3 and 5 produce deterministic UUIDs generated by hashing a namespace identifier and name and version-4 UUIDs are generated. Default: internal uuid counter is used, as per 4.2.1.2.īuffer - (Array | Buffer) Array or buffer where UUID bytes are to be written. nsecs - (Number between 0-9999) additional time, in 100-nanosecond units.msecs - (Number | Date) 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).Options - (Object) Optional uuid state to apply. Generate and return a RFC4122 v1 (timestamp-based) UUID.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |