Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

croner

Package Overview
Dependencies
Maintainers
1
Versions
228
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

croner

Trigger functions and/or evaluate cron expressions in JavaScript. No dependencies. Most features. All environments.

  • 5.7.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6M
decreased by-4.67%
Maintainers
1
Weekly downloads
 
Created

What is croner?

The croner npm package is a high-performance task scheduler for Node.js that allows you to run tasks at specific times or intervals. It is designed to be a drop-in replacement for the 'cron' package with additional features and improvements.

What are croner's main functionalities?

Simple cron job scheduling

This feature allows you to schedule a task to run at intervals defined by the cron syntax. In the provided code sample, a job is scheduled to run every 5 seconds.

const { Cron } = require('croner');

const job = Cron('*/5 * * * * *', () => {
  console.log('This will run every 5 seconds');
});

One-time execution

This feature allows you to schedule a task to run once at a specific time in the future. The code sample schedules a job to run once after 10 seconds.

const { Cron } = require('croner');

const job = Cron(new Date(Date.now() + 10000), () => {
  console.log('This will run once after 10 seconds');
});

Stopping a job

This feature allows you to stop a scheduled job. In the code sample, a job is scheduled to run every 5 seconds but is stopped after 15 seconds.

const { Cron } = require('croner');

const job = Cron('*/5 * * * * *', () => {
  console.log('This job will be stopped.');
});

setTimeout(() => {
  job.stop();
}, 15000);

Timezone support

This feature allows you to schedule jobs according to a specific timezone. The code sample schedules a job to run at 10:30 AM in the 'America/New_York' timezone.

const { Cron } = require('croner');

const job = Cron('0 30 10 * * *', () => {
  console.log('This will run at 10:30 AM in the America/New_York timezone.');
}, { timezone: 'America/New_York' });

Other packages similar to croner

Keywords

FAQs

Package last updated on 19 Feb 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc