my-snowflake-id-generator
v3.0.1
Published
A simple Snowflake ID generator with customizable ID length and format.
Downloads
101
Maintainers
Readme
Snowflake Id Generator
npm install my-snowflake-id-generator
Then
const SnowflakeGenerator = require('my-snowflake-id-generator');
const generator = new SnowflakeGenerator(1, 1);
// Generate a numeric ID of length 16
console.log(generator.generateId(16));
// Generate a hexadecimal ID of length 16
console.log(generator.generateId(16, true));
If you want to generate the hexadecimal snowflake then use true or else false/nothing.
now you can use this package's snowflake id in your project.