uuid-cron
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

uuid-cron

Generate random uuids in a given time

Getting Started

1. Install

npm install uuid-cron

2. Init cron job

import { init, getCronUUID, stop } from 'uuid-cron';
// for the first param, read cron syntax here: https://www.npmjs.com/package/human-to-cron
init('each 20 seconds');

3. getCronUUID() will return random uuid every 20 seconds

const randomUUID = getCronUUID();

4. On finish, stop the cron job, otherwise it will continue infinitely

stop();

Limit the number of random uuids

use getCronUUID to control the number of uuids generated in each cron job

init('each 20 seconds', 30);
// each 20 second generate 30 random uuids and return one of them each time
const limitedRandomUUIDS = getCronUUID();

Readme

Keywords

Package Sidebar

Install

npm i uuid-cron

Weekly Downloads

0

Version

1.2.0

License

MIT

Unpacked Size

15.5 kB

Total Files

21

Last publish

Collaborators

  • baraz