Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 517 Bytes

README.md

File metadata and controls

21 lines (15 loc) · 517 Bytes

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.