Try crypto.randomBytes():
require('crypto').randomBytes(48, function(err, buffer) {
var token = buffer.toString('hex');
});
The ‘hex’ encoding works in node v0.6.x or newer.
More Related Contents:
- Upload Base64 Image Facebook Graph API
- ReadFile in Base64 Nodejs
- Why are functions synchronous in Javascript?
- Read a file one line at a time in node.js?
- Read environment variables in Node.js
- Correct way to write loops for promise.
- Sequelize model association won’t create a new column
- Make several requests to an API that can only handle 20 request a minute
- Write / add data in JSON file using Node.js
- How to reload or re-render the entire page using AngularJS
- How to set NODE_ENV to production/development in OS X
- Node.js variable declaration and scope
- Mongoose difference between .save() and using update()
- Mongoose the Typescript way…?
- play .wav sound file encoded in base64 with javascript
- Why cant I inline call to res.json?
- What is the difference between post api call and form submission with post method?
- Calling a Cloud Function from another Cloud Function
- What is the node.js equivalent of window[“myvar”] = value?
- Top-level await does not work with node 14.13.-
- NodeJs : TypeError: require(…) is not a function
- How to chain execution of array of functions when every function returns deferred.promise?
- How can one get the file path of the caller function in node.js?
- Using Express Handlebars and Angular JS
- Is there a way to “require” a JS file only once in nodejs?
- How to resolve the Syntax error : await is only valid in async function?
- Is there a way to read image metadata using node.js
- How can I use webpack with express?
- How to apply both ValidationPipe() and ParseIntPipe() to params?
- Approach to multiple MySQL queries with Node.js