Files

83 lines
11 KiB
JSON

{
"_from": "node-cron@^2.0.3",
"_id": "node-cron@2.0.3",
"_inBundle": false,
"_integrity": "sha512-eJI+QitXlwcgiZwNNSRbqsjeZMp5shyajMR81RZCqeW0ZDEj4zU9tpd4nTh/1JsBiKbF8d08FCewiipDmVIYjg==",
"_location": "/node-cron",
"_phantomChildren": {},
"_requested": {
"escapedName": "node-cron",
"fetchSpec": "^2.0.3",
"name": "node-cron",
"raw": "node-cron@^2.0.3",
"rawSpec": "^2.0.3",
"registry": true,
"saveSpec": null,
"type": "range"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/node-cron/-/node-cron-2.0.3.tgz",
"_shasum": "b9649784d0d6c00758410eef22fa54a10e3f602d",
"_spec": "node-cron@^2.0.3",
"_where": "D:\\dev\\xmap\\cm-melon",
"author": {
"name": "Lucas Merencia"
},
"bugs": {
"url": "https://github.com/merencia/node-cron/issues"
},
"bundleDependencies": false,
"collective": {
"mocha": "^5.2.0",
"nyc": "^13.0.1",
"sinon": "^6.2.0",
"type": "opencollective",
"url": "https://opencollective.com/node-cron"
},
"dependencies": {
"opencollective-postinstall": "^2.0.0",
"tz-offset": "0.0.1"
},
"deprecated": false,
"description": "A simple cron-like task scheduler for Node.js",
"devDependencies": {
"coveralls": "^3.0.2",
"expect.js": "^0.3.1",
"istanbul": "^0.4.2",
"mocha": "^4.0.1",
"nyc": "^13.0.1",
"sinon": "^4.1.2"
},
"engines": {
"node": ">=6.0.0"
},
"homepage": "https://github.com/merencia/node-cron",
"keywords": [
"cron",
"job",
"schedule",
"scheduler",
"task"
],
"license": "ISC",
"main": "src/node-cron.js",
"name": "node-cron",
"optionalDependencies": {},
"readme": "# Node Cron\n\n[![npm](https://img.shields.io/npm/l/node-cron.svg)](https://github.com/merencia/node-cron/blob/master/LICENSE.md)\n[![npm](https://img.shields.io/npm/v/node-cron.svg)](https://img.shields.io/npm/v/node-cron.svg)\n[![Coverage Status](https://coveralls.io/repos/github/node-cron/node-cron/badge.svg?branch=master)](https://coveralls.io/github/node-cron/node-cron?branch=master)\n[![Code Climate](https://codeclimate.com/github/node-cron/node-cron/badges/gpa.svg)](https://codeclimate.com/github/merencia/node-cron)\n[![Build Status](https://travis-ci.org/node-cron/node-cron.svg?branch=master)](https://travis-ci.org/merencia/node-cron)\n[![Dependency Status](https://david-dm.org/node-cron/node-cron.svg)](https://david-dm.org/merencia/node-cron)\n[![devDependency Status](https://david-dm.org/node-cron/node-cron/dev-status.svg)](https://david-dm.org/merencia/node-cron#info=devDependencies)\n[![Backers on Open Collective](https://opencollective.com/node-cron/backers/badge.svg)](#backers) \n[![Sponsors on Open Collective](https://opencollective.com/node-cron/sponsors/badge.svg)](#sponsors) \n\nThe node-cron module is tiny task scheduler in pure JavaScript for node.js based on [GNU crontab](https://www.gnu.org/software/mcron/manual/html_node/Crontab-file.html). This module allows you to schedule task in node.js using full crontab syntax.\n\n[![NPM](https://nodei.co/npm/node-cron.png?downloads=true&downloadRank=true&stars=false)](https://nodei.co/npm/node-cron/)\n\n\n## Getting Started\n\nInstall node-cron using npm:\n\n```console\n$ npm install --save node-cron\n```\n\nImport node-cron and schedule a task:\n\n```javascript\nvar cron = require('node-cron');\n\ncron.schedule('* * * * *', () => {\n console.log('running a task every minute');\n});\n```\n\n## Cron Syntax\n\nThis is a quick reference to cron syntax and also shows the options supported by node-cron.\n\n### Allowed fields\n\n```\n # ┌────────────── second (optional)\n # │ ┌──────────── minute\n # │ │ ┌────────── hour\n # │ │ │ ┌──────── day of month\n # │ │ │ │ ┌────── month\n # │ │ │ │ │ ┌──── day of week\n # │ │ │ │ │ │\n # │ │ │ │ │ │\n # * * * * * *\n```\n\n### Allowed values\n\n| field | value |\n|--------------|---------------------|\n| second | 0-59 |\n| minute | 0-59 |\n| hour | 0-23 |\n| day of month | 1-31 |\n| month | 1-12 (or names) |\n| day of week | 0-7 (or names, 0 or 7 are sunday) |\n\n\n#### Using multiples values\n\nYou may use multiples values separated by comma:\n\n```javascript\nvar cron = require('node-cron');\n\ncron.schedule('1,2,4,5 * * * *', () => {\n console.log('running every minute 1, 2, 4 and 5');\n});\n```\n\n#### Using ranges\n\nYou may also define a range of values:\n\n```javascript\nvar cron = require('node-cron');\n\ncron.schedule('1-5 * * * *', () => {\n console.log('running every minute to 1 from 5');\n});\n```\n\n#### Using step values\n\nStep values can be used in conjunction with ranges, following a range with '/' and a number. e.g: `1-10/2` that is the same as `2,4,6,8,10`. Steps are also permitted after an asterisk, so if you want to say “every two minutes”, just use `*/2`.\n\n```javascript\nvar cron = require('node-cron');\n\ncron.schedule('*/2 * * * *', () => {\n console.log('running a task every two minutes');\n});\n```\n\n#### Using names\n\nFor month and week day you also may use names or short names. e.g:\n\n```javascript\nvar cron = require('node-cron');\n\ncron.schedule('* * * January,September Sunday', () => {\n console.log('running on Sundays of January and September');\n});\n```\n\nOr with short names:\n\n```javascript\nvar cron = require('node-cron');\n\ncron.schedule('* * * Jan,Sep Sun', () => {\n console.log('running on Sundays of January and September');\n});\n```\n\n## Cron methods\n\n### Schedule\n\nSchedules given task to be executed whenever the cron expression ticks.\n\nArguments:\n\n- **expression** `string`: Cron expression\n- **function** `Function`: Task to be executed\n- **options** `Object`: Optional configuration for job scheduling.\n\n#### Options\n\n - **scheduled**: A `boolean` to set if the created task is schaduled. Default `true`;\n - **timezone**: The timezone that is used for job scheduling;\n\n **Example**:\n\n ```js\n var cron = require('node-cron');\n\n cron.schedule('0 1 * * *', () => {\n console.log('Runing a job at 01:00 at America/Sao_Paulo timezone');\n }, {\n scheduled: true,\n timezone: \"America/Sao_Paulo\"\n });\n ```\n\n## ScheduledTask methods\n\n### Start\n\nStarts the scheduled task.\n\n```javascript\nvar cron = require('node-cron');\n\nvar task = cron.schedule('* * * * *', () => {\n console.log('stoped task');\n}, {\n scheduled: false\n});\n\ntask.start();\n```\n\n### Stop\n\nThe task won't be executed unless re-started.\n\n```javascript\nvar cron = require('node-cron');\n\nvar task = cron.schedule('* * * * *', () => {\n console.log('will execute every minute until stopped');\n});\n\ntask.stop();\n```\n\n### Destroy\n\nThe task will be stopped and completely destroyed.\n\n```javascript\nvar cron = require('node-cron');\n\nvar task = cron.schedule('* * * * *', () => {\n console.log('will not execute anymore, nor be able to restart');\n});\n\ntask.destroy();\n```\n\n### Validate\n\nValidate that the given string is a valid cron expression.\n\n```javascript\nvar cron = require('node-cron');\n\nvar valid = cron.validate('59 * * * *');\nvar invalid = cron.validate('60 * * * *');\n```\n\n## Issues\n\nFeel free to submit issues and enhancement requests [here](https://github.com/merencia/node-cron/issues).\n\n## Contributors\n\nIn general, we follow the \"fork-and-pull\" Git workflow.\n\n - Fork the repo on GitHub;\n - Commit changes to a branch in your fork;\n - Pull request \"upstream\" with your changes;\n\nNOTE: Be sure to merge the latest from \"upstream\" before making a pull request!\n\nPlease 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.\n\n## Contributors\n\nThis project exists thanks to all the people who contribute. \n<a href=\"graphs/contributors\"><img src=\"https://opencollective.com/node-cron/contributors.svg?width=890&button=false\" /></a>\n\n\n## Backers\n\nThank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/node-cron#backer)]\n\n<a href=\"https://opencollective.com/node-cron#backers\" target=\"_blank\"><img src=\"https://opencollective.com/node-cron/backers.svg?width=890\"></a>\n\n\n## Sponsors\n\nSupport this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/node-cron#sponsor)]\n\n<a href=\"https://opencollective.com/node-cron/sponsor/0/website\" target=\"_blank\"><img src=\"https://opencollective.com/node-cron/sponsor/0/avatar.svg\"></a>\n<a href=\"https://opencollective.com/node-cron/sponsor/1/website\" target=\"_blank\"><img src=\"https://opencollective.com/node-cron/sponsor/1/avatar.svg\"></a>\n<a href=\"https://opencollective.com/node-cron/sponsor/2/website\" target=\"_blank\"><img src=\"https://opencollective.com/node-cron/sponsor/2/avatar.svg\"></a>\n<a href=\"https://opencollective.com/node-cron/sponsor/3/website\" target=\"_blank\"><img src=\"https://opencollective.com/node-cron/sponsor/3/avatar.svg\"></a>\n<a href=\"https://opencollective.com/node-cron/sponsor/4/website\" target=\"_blank\"><img src=\"https://opencollective.com/node-cron/sponsor/4/avatar.svg\"></a>\n<a href=\"https://opencollective.com/node-cron/sponsor/5/website\" target=\"_blank\"><img src=\"https://opencollective.com/node-cron/sponsor/5/avatar.svg\"></a>\n<a href=\"https://opencollective.com/node-cron/sponsor/6/website\" target=\"_blank\"><img src=\"https://opencollective.com/node-cron/sponsor/6/avatar.svg\"></a>\n<a href=\"https://opencollective.com/node-cron/sponsor/7/website\" target=\"_blank\"><img src=\"https://opencollective.com/node-cron/sponsor/7/avatar.svg\"></a>\n<a href=\"https://opencollective.com/node-cron/sponsor/8/website\" target=\"_blank\"><img src=\"https://opencollective.com/node-cron/sponsor/8/avatar.svg\"></a>\n<a href=\"https://opencollective.com/node-cron/sponsor/9/website\" target=\"_blank\"><img src=\"https://opencollective.com/node-cron/sponsor/9/avatar.svg\"></a>\n\n\n\n## License\n\nnode-cron is under [ISC License](https://github.com/merencia/node-cron/blob/master/LICENSE.md).\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/merencia/node-cron.git"
},
"scripts": {
"check": "npm test && npm run coverage",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"postinstall": "opencollective-postinstall",
"test": "nyc --reporter=html --reporter=text mocha --recursive"
},
"version": "2.0.3"
}