@wellers/guid2base64

Functions to convert to (and from) GUIDs and URL-friendly Base64 IDs.


Keywords
GUID, Base64, converter, typescript
License
ISC
Install
npm install @wellers/guid2base64@1.0.1

Documentation

Overview

Functions to convert to (and from) GUIDs and URL-friendly Base64 IDs.

Example

const { toBase64, toGuid } = require("@wellers/guid2base64");

const testGuid = "4a603b63-58f0-453c-a0f7-1526c3d5761e";

const id = toBase64(testGuid);
const guid = toGuid(id);

// toBase64 YztgSvBYPEWg9xUmw9V2Hg
console.log("toBase64", id);

// toGuid 4a603b63-58f0-453c-a0f7-1526c3d5761e
console.log("toGuid", guid);

API

toBase64(guid) - converts a GUID string into a URL-friendly ID string.

  • guid - string

toGuid(id) - converts a URL-friendly ID into a GUID string.

  • id - string