Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to generate unique id in node js

// The fastest possible way to create random 32-char string in Node is 
// by using native crypto module:

const crypto = require("crypto");

const id = crypto.randomBytes(16).toString("hex");

console.log(id); // => f9b327e70bbcf42494ccb28b2d98e00e
Source by gist.github.com #
 
PREVIOUS NEXT
Tagged: #generate #unique #id #node #js
ADD COMMENT
Topic
Name
4+4 =