https://github.com/devsnek/node-snowfall
A Snowflake generator and deconstructor.
https://github.com/devsnek/node-snowfall
Last synced: 5 months ago
JSON representation
A Snowflake generator and deconstructor.
- Host: GitHub
- URL: https://github.com/devsnek/node-snowfall
- Owner: devsnek
- Created: 2017-01-04T22:05:24.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-10T18:15:00.000Z (about 8 years ago)
- Last Synced: 2025-09-19T15:36:40.033Z (6 months ago)
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Snowfall
A Snowflake generator and deconstructor.
[](https://www.npmjs.com/package/snowfall)
[](https://www.npmjs.com/package/snowfall)
[](https://david-dm.org/devsnek/snowfall)
[](https://nodei.co/npm/snowfall/)
```javascript
const Snowfall = require('snowfall');
const flurry = new Snowfall({
epoch: Snowfall.EPOCHS.TWITTER,
workerID: 7n,
processID: 21n,
});
// generate a new snowflake
let flake = flurry.next();
// generate a snowflake with a custom date and interval
flake = flurry.next({
timestamp: BigInt(new Date('2015-01-01').getTime()),
internval: 10n,
});
console.log(flurry.deconstruct(flake));
```