{"id":21373191,"url":"https://github.com/nasriyasoftware/nasriyacron","last_synced_at":"2025-07-16T11:14:18.513Z","repository":{"id":225835177,"uuid":"759704867","full_name":"nasriyasoftware/NasriyaCron","owner":"nasriyasoftware","description":"Easily generate cron-expressions, schedule periodic cron jobs as well as time specific tasks. ","archived":false,"fork":false,"pushed_at":"2024-08-17T18:36:05.000Z","size":198,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T12:07:50.537Z","etag":null,"topics":["cron","cron-expression","cronjob","cronjob-scheduler","typescipt"],"latest_commit_sha":null,"homepage":"https://nasriya.net","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nasriyasoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-19T07:15:19.000Z","updated_at":"2024-09-12T19:47:59.000Z","dependencies_parsed_at":"2024-08-07T11:44:07.643Z","dependency_job_id":"a841cee9-d013-4c15-aa98-7f3f306ed113","html_url":"https://github.com/nasriyasoftware/NasriyaCron","commit_stats":null,"previous_names":["nasriyasoftware/nasriyacron"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nasriyasoftware%2FNasriyaCron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nasriyasoftware%2FNasriyaCron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nasriyasoftware%2FNasriyaCron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nasriyasoftware%2FNasriyaCron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nasriyasoftware","download_url":"https://codeload.github.com/nasriyasoftware/NasriyaCron/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248877985,"owners_count":21176243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cron","cron-expression","cronjob","cronjob-scheduler","typescipt"],"created_at":"2024-11-22T08:26:16.745Z","updated_at":"2025-07-16T11:14:18.482Z","avatar_url":"https://github.com/nasriyasoftware.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![N|Solid](https://static.wixstatic.com/media/72ffe6_da8d2142d49c42b29c96ba80c8a91a6c~mv2.png)](https://nasriya.net)\n\n# NasriyaCron.\n[![NPM License](https://img.shields.io/npm/l/%40nasriya%2Fcron?color=lightgreen)](https://github.com/nasriyasoftware/NasriyaCron?tab=License-1-ov-file) ![NPM Version](https://img.shields.io/npm/v/%40nasriya%2Fcron) ![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/%40nasriya%2Fcron) ![Last Commit](https://img.shields.io/github/last-commit/nasriyasoftware/NasriyaCron.svg) [![Status](https://img.shields.io/badge/Status-Stable-lightgreen.svg)](link-to-your-status-page)\n\n##### Visit us at [www.nasriya.net](https://nasriya.net).\n\nMade with ❤️ in **Palestine** 🇵🇸\n___\n#### Overview\nEasily generate cron-expressions, schedule periodic cron jobs as well as time specific tasks.\n\n\u003e [!IMPORTANT]\n\u003e \n\u003e 🌟 **Support Our Open-Source Development!** 🌟\n\u003e We need your support to keep our projects going! If you find our work valuable, please consider contributing. Your support helps us continue to develop and maintain these tools.\n\u003e \n\u003e **[Click here to support us!](https://fund.nasriya.net/)**\n\u003e \n\u003e Every contribution, big or small, makes a difference. Thank you for your generosity and support!\n___\n### Installation\n```shell\nnpm i @nasriya/cron\n```\n\n### Importing\nImport in **ES6** module\n```ts\nimport cron from '@nasriya/cron';\n```\n\nImport in **CommonJS (CJS)**\n```js\nconst cron = require('@nasriya/cron').default;\n```\n___\n\n## Usage\n###### Generate Time Expressions\nUse the `time` module on the cron manager to easily generate cron-expressions.\n\n```ts\n// Runs every 5 minutes\nconst expression1: string = cron.time.every(5).minutes();\n\n// Runs every Monday and Tuesday\nconst expression2: string = cron.time.onSpecificDays(['Tue', 2]);\n```\n\n###### Schedule a Periodic Task\nTo schedule tasks using a cron-expression, use the `schedule` method:\n\n```ts\nconst task: ScheduledTask = cron.schedule('* * * * *', () =\u003e {\n    console.log('A cron-job is running...');\n}, {\n    name: 'test_task',          // (Optional) The name of the task\n    timezone: 'Asia/Jerusalem', // (Optional) The timezone the task will run at\n    runOnInit: false            // (Optional) Set to \"true\" to run immediately\n})\n```\n\nThe `schedule` method returns a `ScheduledTask` type:\n```ts\ninterface ScheduledTask {\n    name: string;                   // The name of the task\n    start: () =\u003e void;              // Start/resume the task\n    stop: () =\u003e void;               // Pause the task\n    destroy: () =\u003e Promise\u003cvoid\u003e;   // Destroy the task\n}\n```\n\n###### Schedule a One-Time Task\nTo schedule one-time tasks use the `scheduleTime` method. The method takes two arguments:\n1. `time`: A timestamp `number`, an [ISO date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString), or a `Date` instance.\n2. `task`: a `function`.\n```ts\n// Schedule a task to run after 10 minutes from now:\nconst tenMins = 10 * 60 * 1000;\nconst task: ScheduledTimedTask = cron.scheduleTime(Date.now() + tenMins, () =\u003e {\n    console.log('Ten minutes has elapsed since the task was first scheduled')\n})\n```\n\nThe `scheduleTime` method returns a `ScheduledTimedTask` type:\n```ts\ninterface ScheduledTimedTask {\n    name: string;                   // The name of the task\n    cancel: () =\u003e void;             // Cancel the task\n    invoke: () =\u003e void;             // Invoke the task\n    destroy: () =\u003e Promise\u003cvoid\u003e;   // Destroy the task\n}\n```\n___\n## License\nThis software is licensed under the **Nasriya Open License (NOL)**, version 1.0.\nPlease read the license from [here](https://github.com/nasriyasoftware/NasriyaCron?tab=License-1-ov-file).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnasriyasoftware%2Fnasriyacron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnasriyasoftware%2Fnasriyacron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnasriyasoftware%2Fnasriyacron/lists"}