@dreamystify/fingrprint
TypeScript icon, indicating that this package has built-in type declarations

0.1.7 • Public • Published



A distributed, k-sortable unique ID generation system using Redis and Lua, inspired by Icicle.

npm version npm version Coverage Status

Getting started

Prerequisites

  • Node.js v14+
  • Redis v6+

Installation

npm install @dreamystify/fingrprint

To build the package locally with the TypeScript compiler, run:

npm run compile

Usage

import Fingrprint from '@dreamystify/fingrprint';

const fingrprint = new Fingrprint({
    host: `localhost`,
    port: 6379,
    username: `username`,
    password: `password`
});

And to use it,

const id = await fingrprint.getId();
// 6936951099534350941n

const ids = await fingrprint.getIds(); // defaults to 1
// [6936951099534350941n]

const ids = await fingrprint.getIds(3);
// [6936951099534350941n, 6936951099534350942n, 6936951099534350943n]

Kudos

The project was inspired by Icicle, just setup for node.js.

Package Sidebar

Install

npm i @dreamystify/fingrprint

Weekly Downloads

8

Version

0.1.7

License

MIT

Unpacked Size

18.1 kB

Total Files

5

Last publish

Collaborators

  • corey_lylyk