# TimeUuid

<div class="jsdoc-content"><header>
    
        <h2><span class="attribs"><span class="type-signature"></span></span>
            <span class="ancestors"><a href="index.html">types</a>~</span>TimeUuid<span class="signature">(date<span class="signature-attributes">opt</span>, ticks<span class="signature-attributes">opt</span>, nodeId<span class="signature-attributes">opt</span>, clockId<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h2>
        
            <div class="class-description"><p>Represents an immutable version 1 universally unique identifier (UUID). A UUID represents a 128-bit value.</p></div>
        
    
</header>


    
        

    
    </div>

## Constructor

<div class="jsdoc-content">
    

    
    <h4 class="name" id="TimeUuid"><span class="type-signature"></span>new TimeUuid<span class="signature">(date<span class="signature-attributes">opt</span>, ticks<span class="signature-attributes">opt</span>, nodeId<span class="signature-attributes">opt</span>, clockId<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>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.</p>
<p>If nodeId and/or clockId portions are not provided, the constructor will generate them using
<code>crypto.randomBytes()</code>. As it's possible that <code>crypto.randomBytes()</code> might block, it's
recommended that you use the callback-based version of the static methods <code>fromDate()</code> or
<code>now()</code>in that case.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>date</code></td>
            

            <td class="type">
            
                
<span class="param-type">Date</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>The date for the instance. If not provided, current Date will be used.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>ticks</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>A number from 0 to 10000 representing the 100-nanoseconds units for this instance to fill in
the information not available in the Date, as Ecmascript Dates have only milliseconds precision.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>nodeId</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">Buffer</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>A 6-length Buffer or string of 6 ascii characters representing the node identifier, ie: 'host01'.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>clockId</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">Buffer</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>A 2-length Buffer or string of 6 ascii characters representing the clock identifier.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/time-uuid.js#L51" target="_blank" rel="noopener">types/time-uuid.js, line 51</a></p></div>




















    
    

    
        </div>

## Extends

<div class="jsdoc-content">

        


    <ul>
        <li><a href="Uuid.html">module:types~Uuid</a></li>
    </ul>


    

    

    

    

    

    

    
        </div>

## Members

<div class="jsdoc-content">

        
            
<h4 class="name" id="buffer"><span class="type-signature">(readonly) </span>buffer<span class="type-signature"></span></h4>




<div class="description">
    <p>Returns the underlying buffer</p>
</div>







<dl class="details">

    

    

    

    
    <dt class="tag-overrides">Overrides:</dt>
    <dd class="tag-overrides"><ul class="dummy"><li>
        <a href="Uuid.html#buffer">module:types~Uuid#buffer</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    
    
    

    

    

    
</dl><div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/uuid.ts#L37" target="_blank" rel="noopener">types/uuid.ts, line 37</a></p></div>






        
            
<h4 class="name" id="uuidRegex"><span class="type-signature"></span>uuidRegex<span class="type-signature"></span></h4>




<div class="description">
    <p>Used to check if the UUID is in a correct format
Source: https://stackoverflow.com/a/6640851
Verified also with documentation of UUID library in Rust: https://docs.rs/uuid/latest/uuid/</p>
</div>







<dl class="details">

    

    

    

    
    <dt class="tag-overrides">Overrides:</dt>
    <dd class="tag-overrides"><ul class="dummy"><li>
        <a href="Uuid.html#uuidRegex">module:types~Uuid#uuidRegex</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    
    
    

    

    

    
</dl><div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/uuid.ts#L15" target="_blank" rel="noopener">types/uuid.ts, line 15</a></p></div>






        
    

    
        </div>

## Methods

<div class="jsdoc-content">

        
            

    

    
    <h4 class="name" id="equals"><span class="type-signature"></span>equals<span class="signature">(other)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>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.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>other</code></td>
            

            <td class="type">
            
            </td>

            

            

            <td class="description last"><p>The other value to test for equality.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    
    <dt class="tag-overrides">Overrides:</dt>
    <dd class="tag-overrides"><ul class="dummy"><li>
        <a href="Uuid.html#equals">module:types~Uuid#equals</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    
    
    

    

    

    
</dl><div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/uuid.ts#L92" target="_blank" rel="noopener">types/uuid.ts, line 92</a></p></div>




















        
            

    

    
    <h4 class="name" id="getBuffer"><span class="type-signature"></span>getBuffer<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Gets the bytes representation of a Uuid</p>
</div>













<dl class="details">

    

    

    

    
    <dt class="tag-overrides">Overrides:</dt>
    <dd class="tag-overrides"><ul class="dummy"><li>
        <a href="Uuid.html#getBuffer">module:types~Uuid#getBuffer</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    
    
    

    

    

    
</dl><div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/uuid.ts#L82" target="_blank" rel="noopener">types/uuid.ts, line 82</a></p></div>




















        
            

    

    
    <h4 class="name" id="getClockId"><span class="type-signature"></span>getClockId<span class="signature">()</span><span class="type-signature"> &rarr; {Buffer}</span></h4>
    

    



<div class="description">
    <p>Returns the clock id this instance, with the variant applied (first 2 msb being 1 and 0).</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/time-uuid.js#L253" target="_blank" rel="noopener">types/time-uuid.js, line 253</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Buffer</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="getDate"><span class="type-signature"></span>getDate<span class="signature">()</span><span class="type-signature"> &rarr; {Date}</span></h4>
    

    



<div class="description">
    <p>Gets the Date representation of this instance.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/time-uuid.js#L237" target="_blank" rel="noopener">types/time-uuid.js, line 237</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Date</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="getDatePrecision"><span class="type-signature"></span>getDatePrecision<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
    

    



<div class="description">
    <p>Gets the Date and 100-nanoseconds units representation of this instance.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/time-uuid.js#L215" target="_blank" rel="noopener">types/time-uuid.js, line 215</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Object</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="getNodeId"><span class="type-signature"></span>getNodeId<span class="signature">()</span><span class="type-signature"> &rarr; {Buffer}</span></h4>
    

    



<div class="description">
    <p>Returns the node id this instance</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/time-uuid.js#L245" target="_blank" rel="noopener">types/time-uuid.js, line 245</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Buffer</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="getNodeIdString"><span class="type-signature"></span>getNodeIdString<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
    

    



<div class="description">
    <p>Returns the node id this instance as an ascii string</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/time-uuid.js#L261" target="_blank" rel="noopener">types/time-uuid.js, line 261</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">string</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="inspect"><span class="type-signature"></span>inspect<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Provide the name of the constructor and the string representation</p>
</div>













<dl class="details">

    

    

    

    
    <dt class="tag-overrides">Overrides:</dt>
    <dd class="tag-overrides"><ul class="dummy"><li>
        <a href="Uuid.html#inspect">module:types~Uuid#inspect</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    
    
    

    

    

    
</dl><div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/uuid.ts#L112" target="_blank" rel="noopener">types/uuid.ts, line 112</a></p></div>




















        
            

    

    
    <h4 class="name" id="toJSON"><span class="type-signature"></span>toJSON<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Returns the string representation.
Method used by the native JSON.stringify() to serialize this instance.</p>
</div>













<dl class="details">

    

    

    

    
    <dt class="tag-overrides">Overrides:</dt>
    <dd class="tag-overrides"><ul class="dummy"><li>
        <a href="Uuid.html#toJSON">module:types~Uuid#toJSON</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    
    
    

    

    

    
</dl><div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/uuid.ts#L120" target="_blank" rel="noopener">types/uuid.ts, line 120</a></p></div>




















        
            

    

    
    <h4 class="name" id="toString"><span class="type-signature"></span>toString<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>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.</p>
</div>













<dl class="details">

    

    

    

    
    <dt class="tag-overrides">Overrides:</dt>
    <dd class="tag-overrides"><ul class="dummy"><li>
        <a href="Uuid.html#toString">module:types~Uuid#toString</a>
    </li></ul></dd>
    

    

    

    

    

    

    

    

    

    
    
    

    

    

    
</dl><div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/uuid.ts#L103" target="_blank" rel="noopener">types/uuid.ts, line 103</a></p></div>




















        
            

    

    
    <h4 class="name" id=".fromDate"><span class="type-signature">(static) </span>fromDate<span class="signature">(date, ticks<span class="signature-attributes">opt</span>, nodeId<span class="signature-attributes">opt</span>, clockId<span class="signature-attributes">opt</span>, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Generates a TimeUuid instance based on the Date provided using random node and clock values.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>date</code></td>
            

            <td class="type">
            
                
<span class="param-type">Date</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            

            <td class="description last"><p>Date to generate the v1 uuid.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>ticks</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>A number from 0 to 10000 representing the 100-nanoseconds units for this instance to fill in
the information not available in the Date, as Ecmascript Dates have only milliseconds precision.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>nodeId</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">Buffer</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>A 6-length Buffer or string of 6 ascii characters representing the node identifier, ie: 'host01'.
If not provided, a random nodeId will be generated.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>clockId</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">Buffer</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>A 2-length Buffer or string of 6 ascii characters representing the clock identifier.
If not provided a random clockId will be generated.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>callback</code></td>
            

            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An optional callback to be invoked with the error as first parameter and the created
<code>TimeUuid</code> as second parameter. When a callback is provided, the random portions of the
<code>TimeUuid</code> instance are created asynchronously.</p>
<p>When nodeId and/or clockId portions are not provided, this method will generate them using
<code>crypto.randomBytes()</code>. As it's possible that <code>crypto.randomBytes()</code> might block, it's
recommended that you use the callback-based version of this method in that case.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/time-uuid.js#L111" target="_blank" rel="noopener">types/time-uuid.js, line 111</a></p></div>



















    <h5>Examples</h5>
    
        <p class="code-caption">Generate a TimeUuid from a ECMAScript Date</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>const timeuuid = TimeUuid.fromDate(new Date());</pre></div></div>

        <p class="code-caption">Generate a TimeUuid from a Date with ticks portion</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>const timeuuid = TimeUuid.fromDate(new Date(), 1203);</pre></div></div>

        <p class="code-caption">Generate a TimeUuid from a Date without any random portion</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>const timeuuid = TimeUuid.fromDate(new Date(), 1203, 'host01', '02');</pre></div></div>

        <p class="code-caption">Generate a TimeUuid from a Date with random node and clock identifiers</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>TimeUuid.fromDate(new Date(), 1203, function (err, timeuuid) {
  // do something with the generated timeuuid
});</pre></div></div>



        
            

    

    
    <h4 class="name" id=".fromString"><span class="type-signature">(static) </span>fromString<span class="signature">(value)</span><span class="type-signature"> &rarr; {TimeUuid}</span></h4>
    

    



<div class="description">
    <p>Parses a string representation of a TimeUuid</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>value</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>should be in 00000000-0000-0000-0000-000000000000 format</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/time-uuid.js#L160" target="_blank" rel="noopener">types/time-uuid.js, line 160</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">TimeUuid</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id=".max"><span class="type-signature">(static) </span>max<span class="signature">(date, ticks)</span><span class="type-signature"> &rarr; {TimeUuid}</span></h4>
    

    



<div class="description">
    <p>Returns the biggest possible type 1 uuid with the provided Date.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>date</code></td>
            

            <td class="type">
            
                
<span class="param-type">Date</span>


            
            </td>

            

            

            <td class="description last"></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>ticks</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            

            

            <td class="description last"></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/time-uuid.js#L180" target="_blank" rel="noopener">types/time-uuid.js, line 180</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">TimeUuid</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id=".min"><span class="type-signature">(static) </span>min<span class="signature">(date, ticks)</span><span class="type-signature"> &rarr; {TimeUuid}</span></h4>
    

    



<div class="description">
    <p>Returns the smallest possible type 1 uuid with the provided Date.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>date</code></td>
            

            <td class="type">
            
                
<span class="param-type">Date</span>


            
            </td>

            

            

            <td class="description last"></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>ticks</code></td>
            

            <td class="type">
            
                
<span class="param-type">number</span>


            
            </td>

            

            

            <td class="description last"></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/time-uuid.js#L170" target="_blank" rel="noopener">types/time-uuid.js, line 170</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">TimeUuid</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id=".now"><span class="type-signature">(static) </span>now<span class="signature">(nodeId<span class="signature-attributes">opt</span>, clockId<span class="signature-attributes">opt</span>, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Generates a TimeUuid instance based on the current date using random node and clock values.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>nodeId</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">Buffer</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>A 6-length Buffer or string of 6 ascii characters representing the node identifier, ie: 'host01'.
If not provided, a random nodeId will be generated.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>clockId</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>
|

<span class="param-type">Buffer</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>A 2-length Buffer or string of 6 ascii characters representing the clock identifier.
If not provided a random clockId will be generated.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>callback</code></td>
            

            <td class="type">
            
                
<span class="param-type">function</span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            

            <td class="description last"><p>An optional callback to be invoked with the error as first parameter and the created
<code>TimeUuid</code> as second parameter. When a callback is provided, the random portions of the
<code>TimeUuid</code> instance are created asynchronously.</p>
<p>When nodeId and/or clockId portions are not provided, this method will generate them using
<code>crypto.randomBytes()</code>. As it's possible that <code>crypto.randomBytes()</code> might block, it's
recommended that you use the callback-based version of this method in that case.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/time-uuid.js#L207" target="_blank" rel="noopener">types/time-uuid.js, line 207</a></p></div>



















    <h5>Examples</h5>
    
        <p class="code-caption">Generate a TimeUuid from a Date without any random portion</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>const timeuuid = TimeUuid.now('host01', '02');</pre></div></div>

        <p class="code-caption">Generate a TimeUuid with random node and clock identifiers</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>TimeUuid.now(function (err, timeuuid) {
  // do something with the generated timeuuid
});</pre></div></div>

        <p class="code-caption">Generate a TimeUuid based on the current date (might block)</p>
    
    <div class="highlight-javascript notranslate"><div class="highlight"><pre>const timeuuid = TimeUuid.now();</pre></div></div></div>
