futoin-uuid

UUID utility with compact Base64 formatting

Usage no npm install needed!

<script type="module">
  import futoinUuid from 'https://cdn.skypack.dev/futoin-uuid';
</script>

README

NPM Version NPM Downloads Build Status stable

NPM

About

A primitive wrapper of uuid package for UUID v4 generation with Base64 encoding.

The reason is to get a universal and short UUID representation in printable characters which can be efficiently used in JSON and databases without special UUID type.

It produces only 22 characters instead of canonical 36 hexdecimal chars with separators.

Documentation --> FutoIn Guide

Author: Andrey Galkin

Installation for Node.js

Command line:

$ npm install futoin-uuid --save

or:

$ yarn add futoin-uuid --save

Examples

const UUIDTool = require('futoin-uuid');

UUIDTool.genBin(); // -> Buffer(16)
UUIDTool.genB64(); // -> String(22)

API documentation

UUIDTool

Common tool for UUID generation and use in transactions

Kind: global class

UUIDTool.genBin() ⇒ Buffer

Generate UUID v4

Kind: static method of UUIDTool
Returns: Buffer - buffer of 16 items

UUIDTool.genB64() ⇒ string

Generate UUID v4 encoded in Base64 without padding

Kind: static method of UUIDTool
Returns: string - 22 characters