node-cron

A Lightweight Task Scheduler for Node.js

node-cron downloads node-cron version node-cron license

node-cron类似的npm包:
npm下载趋势
3 年
🌟 在 node-cron 的 README.md 中显示实时使用量图表,只需复制下面的代码。
## Usage Trend
[![Usage Trend of node-cron](https://npm-compare.com/img/npm-trend/THREE_YEARS/node-cron.png)](https://npm-compare.com/node-cron#timeRange=THREE_YEARS)
Cumulative GitHub Star Trend
🌟 在 node-cron 的 README.md 中显示 GitHub stars 趋势图表,只需复制下面的代码。
## GitHub Stars Trend
[![GitHub Stars Trend of node-cron](https://npm-compare.com/img/github-trend/node-cron.png)](https://npm-compare.com/node-cron)
统计详情
npm包名称
下载量
Stars
大小
Issues
发布时间
License
node-cron1,852,9903,185221 kB214 个月前ISC
node-cron的README

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

fieldvalue
second0-59
minute0-59
hour0-23
day of month1-31
month1-12 (or names)
day of week0-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.

Backers

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

Sponsors

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

License

node-cron is under ISC License.