UNPKG

@somosphi/uuid

Version:

Utility functions for dealing with UUIDs

21 lines (20 loc) 671 B
/// <reference types="node" /> /** * Generates a random v4 UUID. * @returns the UUID in string format */ export declare const generate: (() => string); /** * Converts a UUID in string format to binary. * @param uuidString a valid UUID in string format * @returns the UUID in binary format * @throws if the string is not a valid UUID */ export declare function stringToBinary(uuidString: string): Buffer; /** * Converts a UUID in binary format to a string. * @param uuidBuffer a valid UUID in binary format * @returns the UUID in string format * @throws if the buffer is not a valid UUID */ export declare function binaryToString(uuidBuffer: Buffer): string;