task-warp
v1.1.0
Published
task-warp is a simple Node.js module for scheduling and managing recurring tasks using the node-schedule library.
Downloads
1
Readme
task-warp
task-warp is a simple Node.js module for scheduling and managing recurring tasks using the node-schedule library.
Installation
To install the task-warp module, run the following command:
npm install task-warp
Usage
const TaskScheduler = require('task-warp');
// Create an instance of TaskScheduler
const taskScheduler = new TaskScheduler();
// Schedule a task to run every minute
const scheduledTask = taskScheduler.scheduleTask('* * * * *', () => {
console.log('Task executed at:', new Date());
});
// Delete a task after 5 minutes
setTimeout(() => {
taskScheduler.deleteTask(scheduledTask);
console.log('Task deleted at:', new Date());
}, 5 * 60 * 1000);
// Schedule another task to run every 5 seconds
const anotherScheduledTask = taskScheduler.scheduleTask('*/5 * * * * *', () => {
console.log('Another task executed at:', new Date());
});
// Delete all tasks after 1 minute
setTimeout(() => {
taskScheduler.deleteAllTask();
console.log('All tasks deleted at:', new Date());
}, 1 * 60 * 1000);
Features
- Schedule tasks using cron expressions.
- Delete individual tasks or all tasks at once.
- Easy-to-use API.
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.