@dreamystify/fingrprint
v0.1.26
Published
A distributed, k-sortable unique ID generation system using Redis and Lua, inspired by Icicle.
Downloads
563
Maintainers
Readme
Getting started
Prerequisites
- Node.js v18+
- Redis v6+
# Initialize the repo
./.scripts/init.sh
Installation
npm install @dreamystify/fingrprint
To build the package locally with the TypeScript compiler, run:
npm run build
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.