auto-tasker

0.0.8 • Public • Published

auto-tasks

A Node.js scheduling utility that simplifies task scheduling with human-readable syntax. Convert intuitive time formats into cron expressions and schedule tasks effortlessly using node-cron.

Installation

npm install auto-tasker

Usage

Example-1:

const { ScheduleBuilder } = require("auto-tasker");
const callBackTask = () => {
  console.log("hello world");
};
const schedule = new ScheduleBuilder();
const scheduleCron = schedule
  .every("week")
  .on("monday")
  .at("05:30", "pm")
  .do(callBackTask);

Example-2:

const { ScheduleBuilder } = require("auto-tasker");
const callBackTask = () => {
  console.log("hello world");
};
const schedule = new ScheduleBuilder();
const scheduleCron = schedule.every("day").at("10:00", "am").do(callBackTask);

Example-3:

const { ScheduleBuilder } = require("auto-tasker");
const callBackTask = () => {
  console.log("hello world");
};
const schedule = new ScheduleBuilder();
const scheduleCron = schedule.on("monday").every("hour").do(callBackTask);

Example-4:

const { ScheduleBuilder } = require("auto-tasker");
const callBackTask = () => {
  console.log("hello world");
};

const schedule = new ScheduleBuilder();
const scheduleCron = schedule.on("tuesday").at("10:00", "am").do(callBackTask);

Example-5: Schedule a task to run every hour

const { ScheduleBuilder } = require("auto-tasker");
const callBackTask = () => {
  console.log("Task running every hour");
};

const schedule = new ScheduleBuilder();
const scheduleCron = schedule.every("hour").do(callBackTask);

Features

  • Human-readable syntax for scheduling tasks.
  • Supports scheduling tasks on specific days of the week.
  • Converts time formats like "10:00 am" to cron expressions.
  • Supports scheduling tasks to run every hour, day, week, or month.
  • Easy-to-use API for scheduling tasks.

License

MIT

Contributing

Please follow the contributing guidelines.

Package Sidebar

Install

npm i auto-tasker

Weekly Downloads

12

Version

0.0.8

License

MIT

Unpacked Size

41.7 kB

Total Files

5

Last publish

Collaborators

  • omar_abo_elwafa60