NPM Star
Collections
  1. Home
  2. Compare
  3. cron vs node-cron
NPM Compare

Compare NPM packages statistics, trends, and features

CollectionsVS Code extensionChrome extensionTermsPrivacyLinkTreeIndiehackersBig Frontendqiuyumi

Cron vs Node-cron: Task Scheduling Tools for Node.js

Both packages help developers schedule tasks to run automatically at specific times, like sending daily emails or cleaning up databases. Cron is the original package with a more traditional approach, while node-cron is a simpler, more beginner-friendly alternative. They both use the familiar cron syntax (like '* * * * *') to set up schedules, but differ in their features and ease of use.

Task Schedulingschedulingautomationtime-based-tasksbackground-jobs

Unable to load comparison data. Please try again later.

Similar Packages

node-schedule

90%

A flexible job scheduler for Node.js. It lets you schedule jobs using simple date-based expressions, similar to cron but with a more JavaScript-friendly syntax.

Closest to cron in terms of simplicity, but with a more natural JavaScript feel. Great for developers who find cron syntax confusing.

Job Scheduler

agenda

80%

A lightweight job scheduling library for Node.js. It uses MongoDB to store jobs and can handle both one-time and repeating tasks. Think of it as a more powerful cron with a database backing.

Great for developers who need more features than basic cron, like job persistence, job queuing, and detailed job control. It's especially good if you're already using MongoDB in your project.

Job Scheduler

bree

80%

A modern job scheduler for Node.js with no dependencies. It supports workers, cron-like scheduling, and promises. It's like a modern, cleaner version of traditional cron.

Good for developers who want a modern, promise-based scheduler without external dependencies. It's newer but gaining popularity due to its clean design.

Job Scheduler

bull

70%

A Redis-based queue system for handling jobs and messages in Node.js. It can schedule jobs, handle retries, and manage job priorities. It's like a super-powered task scheduler with queue features.

Perfect when you need both scheduling and queuing features. It's more robust than cron and great for apps that need to handle many tasks reliably.

Queue & Scheduler

No README available

Node Cron

npm npm NPM Downloads Coverage Status

The node-cron module is tiny task scheduler in pure JavaScript for node.js based on GNU crontab. This module allows you to schedule task in node.js using full crontab syntax.

Node-Cron Documentation

Getting Started

Install node-cron using npm:

npm install --save node-cron

Import node-cron and schedule a task:

  • commonjs
const cron = require('node-cron'); cron.schedule('* * * * *', () => { console.log('running a task every minute'); });
  • es6 (module)
import cron from 'node-cron'; cron.schedule('* * * * *', () => { console.log('running a task every minute'); });

Cron Syntax

This is a quick reference to cron syntax and also shows the options supported by node-cron.

Allowed fields

 # ┌────────────── second (optional)
 # │ ┌──────────── minute
 # │ │ ┌────────── hour
 # │ │ │ ┌──────── day of month
 # │ │ │ │ ┌────── month
 # │ │ │ │ │ ┌──── day of week
 # │ │ │ │ │ │
 # │ │ │ │ │ │
 # * * * * * *

Allowed values

| field | value | | ------------ | --------------------------------- | | second | 0-59 | | minute | 0-59 | | hour | 0-23 | | day of month | 1-31 | | month | 1-12 (or names) | | day of week | 0-7 (or names, 0 or 7 are sunday) |

Issues

Feel free to submit issues and enhancement requests here.

Contributing

In general, we follow the "fork-and-pull" Git workflow.

  • Fork the repo on GitHub;
  • Commit changes to a branch in your fork;
  • Pull request "upstream" with your changes;

NOTE: Be sure to merge the latest from "upstream" before making a pull request!

Please do not contribute code you did not write yourself, unless you are certain you have the legal ability to do so. Also ensure all contributed code can be distributed under the ISC License.

Contributors

This project exists thanks to all the people who contribute. <a href="https://github.com/node-cron/node-cron/graphs/contributors"><img src="https://opencollective.com/node-cron/contributors.svg?width=890&button=false" /></a>

Backers

Thank you to all our backers! 🙏 [Become a backer]

<a href="https://opencollective.com/node-cron#backers" target="_blank"><img src="https://opencollective.com/node-cron/backers.svg?width=890"></a>

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

<a href="https://opencollective.com/node-cron/sponsor/0/website" target="_blank"><img src="https://opencollective.com/node-cron/sponsor/0/avatar.svg"></a> <a href="https://opencollective.com/node-cron/sponsor/1/website" target="_blank"><img src="https://opencollective.com/node-cron/sponsor/1/avatar.svg"></a> <a href="https://opencollective.com/node-cron/sponsor/2/website" target="_blank"><img src="https://opencollective.com/node-cron/sponsor/2/avatar.svg"></a> <a href="https://opencollective.com/node-cron/sponsor/3/website" target="_blank"><img src="https://opencollective.com/node-cron/sponsor/3/avatar.svg"></a> <a href="https://opencollective.com/node-cron/sponsor/4/website" target="_blank"><img src="https://opencollective.com/node-cron/sponsor/4/avatar.svg"></a> <a href="https://opencollective.com/node-cron/sponsor/5/website" target="_blank"><img src="https://opencollective.com/node-cron/sponsor/5/avatar.svg"></a> <a href="https://opencollective.com/node-cron/sponsor/6/website" target="_blank"><img src="https://opencollective.com/node-cron/sponsor/6/avatar.svg"></a> <a href="https://opencollective.com/node-cron/sponsor/7/website" target="_blank"><img src="https://opencollective.com/node-cron/sponsor/7/avatar.svg"></a> <a href="https://opencollective.com/node-cron/sponsor/8/website" target="_blank"><img src="https://opencollective.com/node-cron/sponsor/8/avatar.svg"></a> <a href="https://opencollective.com/node-cron/sponsor/9/website" target="_blank"><img src="https://opencollective.com/node-cron/sponsor/9/avatar.svg"></a>

License

node-cron is under ISC License.

Dependencies Comparison

cron

Dependencies

luxon~3.6.0
@types/luxon~3.6.0

Dev Dependencies

chai5.2.0
jest29.7.0
husky9.1.7
sinon20.0.0
eslint8.57.1
prettier3.5.3
@swc/core1.11.18
@swc/jest0.2.37
cross-env7.0.3
@eslint/js9.24.0
typescript5.8.3
@types/jest29.5.14
@types/node22.14.0
lint-staged15.5.0
@types/sinon17.0.4
@commitlint/cli19.8.0
@fast-check/jest2.1.1
semantic-release24.2.3
typescript-eslint7.18.0
eslint-plugin-jest27.9.0
@semantic-release/git10.0.1
@semantic-release/npm12.0.1
eslint-config-prettier9.1.0
eslint-plugin-prettier5.2.6
@semantic-release/github11.0.1
@semantic-release/changelog6.0.3
@insurgent/commitlint-config20.0.0
@semantic-release/commit-analyzer13.0.1
@insurgent/conventional-changelog-preset10.0.0
@semantic-release/release-notes-generator14.0.3

Peer Dependencies

node-cron

Dependencies

Dev Dependencies

@eslint/js^9.26.0
@tsconfig/recommended^1.0.8
@types/chai^5.2.1
@types/expect^1.20.4
@types/mocha^10.0.10
@types/node^22.15.3
@types/sinon^17.0.4
@typescript-eslint/eslint-plugin^8.32.0
@typescript-eslint/parser^8.32.0
c8^10.1.3
chai^5.2.0
eslint^9.26.0
eslint-plugin-mocha^10.5.0
eslint-plugin-node^11.1.0
globals^16.1.0
mocha^11.1.0
sinon^20.0.0
tsup^8.4.0
tsx^4.19.3
typescript^5.8.3
typescript-eslint^8.32.0

Peer Dependencies

StarsIssuesVersionUpdatedⓘLast publish dateCreatedⓘPackage creation dateSizeⓘMinified + Gzipped size
C
cron
8,732144.3.0a month ago14 years agoinstall size 27.7 KB
N
node-cron
3,04264.0.3a month ago9 years agoinstall size 5.8 KB

Who's Using These Packages

cron

earthcalc
earthcalc

This app calculates how much a distant object is obscured by the earth's curvature.

brand
brand

Whatsapp bot made with awesome features ❤️

node-cron

TravelPackHub
TravelPackHub

みんなの「海外への持ち物」を集めました

aplscore
aplscore

generating tournament, team, players, match, etc.