Skip to content

A bidirectional tool for converting cron expressions between unix and quartz formats

License

Notifications You must be signed in to change notification settings

rahu619/cron-converter-u2q

Repository files navigation

cron-converter-u2q

Github Repo Stars NPM version GitHub License GitHub Build Github Release Github Top Language

https://nodei.co/npm/cron-converter-u2q.png?downloads=true&downloadRank=true&stars=true

Easily work with cron expressions using the cron-converter-u2q package. Effortlessly convert between Unix and Quartz formats and describe cron schedules in plain language.

Features

🔄 Two-way conversion

Effortlessly convert cron expressions:

  • From Unix to Quartz
  • From Quartz to Unix

📝 Human-readable Descriptions

Translate cron schedules into plain, understandable text:

  • Example: */5 * * * * -> "Every 5 minutes"

Installation

Using npm:

npm install cron-converter-u2q

Using yarn:

yarn add cron-converter-u2q

Usage

Firstly, import the CronConverterU2Q module:

var cron_converter_u2q = require("cron-converter-u2q");

var c2q = cron_converter_u2q.CronConverterU2Q;

If you're using ES6 Modules

import { CronConverterU2QModule as c2q } from "cron-converter-u2q";

Conversion Methods

Convert from Unix to Quartz:

const quartzExpression = c2q.unixToQuartz("5 * * * *");

Convert from Quartz to Unix:

const unixExpression = c2q.quartzToUnix("* */5 * ? * * *");

Description Methods

You can now generate human-readable descriptions for Unix and Quartz cron expressions.

Describe Unix Cron Expressions:

const description = c2q.describeUnix("5 * * * *");
console.log(description); // Outputs: "Every 5 minutes"

Describe Quartz Cron Expressions:

const description = c2q.describeQuartz("0 0 8 * * ?");
console.log(description); // Outputs: "At 8 o'clock"

License

This project is licensed under the MIT License

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Support

Any feedback, suggestions, or contributions are highly appreciated!

About

A bidirectional tool for converting cron expressions between unix and quartz formats

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published