2

Node-uuid provides an excellent package to generate uuid

https://github.com/broofa/node-uuid

// Generate a v4 (random) id
uuid.v4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'

However, it does not provide a way to encode it in base64 or alphanumeric string.

Is there an easy way to do this?

samol
  • 18,950
  • 32
  • 88
  • 127

1 Answers1

2

Install;

https://github.com/RGBboy/urlsafe-base64

Then;

var uuid = require('node-uuid');
var base64 = require('urlsafe-base64');

base64.encode(Buffer(uuid.v4()));
Bulkan
  • 2,555
  • 1
  • 20
  • 31