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

node-schedule

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-schedule

A cron-like and not-cron-like job scheduler for Node.

  • 0.1.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8M
increased by0.65%
Maintainers
1
Weekly downloads
 
Created

What is node-schedule?

The node-schedule npm package is a flexible cron-like and not-cron-like job scheduler for Node.js. It allows you to schedule jobs (arbitrary functions) for execution at specific dates, with optional recurrence rules. It is suitable for building job schedulers, task reminders, or any other automation based on time events.

What are node-schedule's main functionalities?

One-time jobs

Schedule a job to be executed once at a specific date and time.

const schedule = require('node-schedule');
const date = new Date(2023, 3, 21, 5, 30, 0);

const job = schedule.scheduleJob(date, function() {
  console.log('This job is run once at the specified date.');
});

Recurring jobs using cron-style scheduling

Schedule a job to be executed on a recurring basis using a cron string to specify the frequency.

const schedule = require('node-schedule');

const job = schedule.scheduleJob('*/5 * * * *', function() {
  console.log('This job runs every 5 minutes.');
});

Recurring jobs using object literal syntax

Schedule a job using a more human-readable object literal syntax for setting the schedule.

const schedule = require('node-schedule');

const job = schedule.scheduleJob({hour: 14, minute: 30, dayOfWeek: 1}, function() {
  console.log('This job runs at 2:30pm every Monday.');
});

Canceling jobs

Cancel a scheduled job before it is executed.

const schedule = require('node-schedule');
const job = schedule.scheduleJob('*/5 * * * *', function() {
  console.log('This job will be canceled.');
});

job.cancel();

Other packages similar to node-schedule

Keywords

FAQs

Package last updated on 09 Mar 2013

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