UUIDv5
Install
npm install uuidv5
Use
var uuidv5 = require('uuidv5');
If you are unfamiliar with v5 UUIDs, read this. For a deeper look, read RFC 4122.
API
uuidv5(namespace, name, [raw_output])
namespace
can be 'url', 'dns', 'oid', 'x500', or 'null'. If it's none of those, it must be a UUID to use as a namespace, either in string or Buffer form.name
can be a string or Buffer. What it should contain is namespace-dependent.raw_output
is an optional flag. If set totrue
, the UUID will be returned as a Buffer instead of as a string.
uuidv5.uuidToString(uuid)
Takes a Buffer-form uuid and returns it as a string.
uuidv5.uuidFromString(uuidStr)
Takes a UUID as a string (with or without dashes [-]) and returns it as a Buffer.
Examples
var uuidv5 = ; // Generate a UUID in the default URL namespacevar urlUUID = ; // Default DNS namespacevar dnsUUID = ; // Create your own namespacevar privns = ; // Buffer form is more efficientvar privUUID = ;