# nanoflakes

> Reference implementation of nanoflakes for JavaScript

Latest version **1.0.2** (published 2022-05-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install nanoflakes
pnpm add nanoflakes
yarn add nanoflakes
bun add nanoflakes
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-05-28 |
| First published | 2022-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 18.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Adrian Todt |
| Maintainers | adriantodt |
| Keywords | nanoflakes, snowflakes |

## Links

- npm: https://www.npmjs.com/package/nanoflakes
- Repository: https://github.com/nanoflakes/nanoflakes-js
- Homepage: https://github.com/nanoflakes/nanoflakes-js#readme
- Issues: https://github.com/nanoflakes/nanoflakes-js/issues
- npm.io page: https://npm.io/package/nanoflakes

## Recent versions

- 1.0.2 (latest) — 2022-05-28
- 1.0.1 — 2022-05-28
- 1.0.0 — 2022-05-28

## README

# Nanoflakes - JavaScript

[![npm](https://img.shields.io/npm/v/nanoflakes)](https://www.npmjs.com/package/nanoflakes)
[![GitHub issues](https://img.shields.io/github/issues/nanoflakes/nanoflakes-js)](https://github.com/nanoflakes/nanoflakes-js/issues)
[![License](https://img.shields.io/github/license/nanoflakes/nanoflakes-js)](https://github.com/nanoflakes/nanoflakes-js/tree/master/LICENSE)
[![Twitter](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2Fnanoflakes%2Fnanoflakes-js)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Fnanoflakes%2Fnanoflakes-js)

Reference implementation of [nanoflakes](https://github.com/nanoflakes/nanoflakes) for JavaScript.

Licensed under the [MIT License](https://github.com/nanoflakes/nanoflakes-java/blob/master/LICENSE).

### Installation

Run the following command to install the package:

```shell
# on NPM...
$ npm install nanoflakes

# on Yarn...
$ yarn add nanoflakes
```

### Usage

- Use `localGenerator(epoch, generatorId)` to create a local nanoflake generator.
    - You can get an epoch by calling `Date.now()` in a Node.js shell.
    - A generator ID must be in the 0-1023 range.
- Use `NanoflakeGenerator.next()` to get a new nanoflake.
- The `Nanoflake` class is the result type `NanoflakeGenerator.next()`. It can be used as-is, or getting it's raw or encoded value. It also features utility methods such as getting the creation time of the nanoflake.

### Support

Extra support is given on [Cafeteria Development](https://discord.gg/MrH5AXZABr).

[![Aru's Discord Server](https://discordapp.com/api/guilds/707435077679841350/embed.png?style=banner2)](https://discord.gg/MrH5AXZABr)

---
_Source: https://npm.io/package/nanoflakes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
