class TimeUuid
Represents an immutable version 1 universally unique identifier (UUID). A UUID represents a 128-bit value.
Usage: TimeUuid.now()
Augments
Constructor
Creates a new instance of Uuid based on the parameters provided according to rfc4122. If any of the arguments is not provided, it will be randomly generated, except for the date that will use the current date.
Note that when nodeId and/or clockId portions are not provided, the constructor will generate them using
crypto.randomBytes()
. As it’s possible that crypto.randomBytes()
might block, it’s
recommended that you use the callback-based version of the static methods fromDate()
or
now()
in that case.
Methods
equals
(Uuid
other)
Compares this object to the specified object. The result is true if and only if the argument is not null, is a UUID object, and contains the same value, bit for bit, as this UUID.
TimeUuid.fromDate
(Date
date, [Number
ticks], [String
or Buffer
nodeId], [String
or Buffer
clockId], [function
callback])
Generates a TimeUuid instance based on the Date provided using random node and clock values.
- Static
- This function is static
TimeUuid.fromString
(String
value)
Parses a string representation of a TimeUuid
- Static
- This function is static
getBuffer
()Gets the bytes representation of a Uuid
getClockId
()Returns the clock id this instance, with the variant applied (first 2 msb being 1 and 0).
getDate
()Gets the Date representation of this instance.
getDatePrecision
()Gets the Date and 100-nanoseconds units representation of this instance.
getNodeId
()Returns the node id this instance
getNodeIdString
()Returns the node id this instance as an ascii string
inspect
()Provide the name of the constructor and the string representation
TimeUuid.max
()Returns the biggest possible type 1 uuid with the provided Date.
- Static
- This function is static
TimeUuid.min
()Returns the smaller possible type 1 uuid with the provided Date.
- Static
- This function is static
Generates a TimeUuid instance based on the current date using random node and clock values.
- Static
- This function is static
toJSON
()Returns the string representation. Method used by the native JSON.stringify() to serialize this instance.
toString
()Returns a string representation of the value of this Uuid instance. 32 hex separated by hyphens, in the form of 00000000-0000-0000-0000-000000000000.