![]() 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.Įxample: Generate string UUID with fully-specified options uuid. rng - (Function) Random # generator to use.random - (Number) Array of 16 numbers (0-255) to use in place of randomly generated values.The term globally unique identifier (GUID) is also used. Uuid.unparse(buffer, 16) // -> '02a31cb0-1432-11e1-8558-0b488e4fc115' uuid.v4(]]) A universally unique identifier (UUID) is a 128-bit label used for information in computer systems. Uuid.v1( null, arr, 16) // -> // Optionally use uuid.unparse() to get stringify the ids (Future versions of this module may use persistent storage mechanisms to extend this guarantee.)Įxample: Generate string UUID with fully-specified options uuid.v1() // -> "710b962e-041c-11e1-9234-0123456789ab"Įxample: In-place generation of two binary IDs // Generate two ids in an array var arr = new Array( 32) // -> Generate v1 and v4 UUIDs Universally unique identifiers are handy in many scenarios, as k6 doesnt have built-in support for UUIDs, well have to resort to using a Node. ![]() ![]() The randomly generated node id is only guaranteed to stay constant for the lifetime of the current JS runtime.Returns buffer, if specified, otherwise the string form of the UUID offset - (Number) Starting index in buffer at which to begin writing.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. Uuid.v1() // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a' // Generate a v4 (random) id UUIDs are generally used for identifying information that needs to be unique within a system or network thereof. Or in node.js: npm install node-uuid var uuid = require( 'node-uuid') Name-based UUIDs Version 3 use MD5 message-digest algorithm whereas Version 5 use SHA1 message-digest algorithm as the hashing algorithms. 1.1K minified and gzip'ed (Want something smaller? Check this crazy shit out! ) The node Id used to generate the example UUID was E1:22:33:A2:F3:45 which is represented by 'e12233a2f345' in UUID.Cryptographically strong random # generation on supporting platforms.Registered as a ComponentJS component ('broofa/node-uuid').Generate RFC4122 version 1 or version 4 UUIDs.Simple, fast generation of RFC4122 UUIDS.
0 Comments
Leave a Reply. |