Socket
Socket
Sign inDemoInstall

uuid-cron

Package Overview
Dependencies
55
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    uuid-cron

uuid-cron


Version published
Maintainers
1
Created

Readme

Source

uuid-cron

Generate random uuids in a given time

Getting Started

1. Install

npm install uuid-cron

2. Init cron job

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

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

const randomUUID = uuidv4Cron();

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

stop();

Limit the number of random uuids

use uuidv4CronLimited 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 = uuidv4CronLimited();

FAQs

Last updated on 16 Oct 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc