Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@types/node-schedule
Advanced tools
TypeScript definitions for node-schedule
@types/node-schedule provides TypeScript definitions for the node-schedule package, which is a flexible cron-like and not-cron-like job scheduler for Node.js.
Scheduling a Job
This feature allows you to schedule a job using a cron-like syntax. In this example, the job is scheduled to run at the 42nd minute of every hour.
const schedule = require('node-schedule');
const job = schedule.scheduleJob('42 * * * *', function(){
console.log('The answer to life, the universe, and everything!');
});
Canceling a Job
This feature allows you to cancel a scheduled job. In this example, the job is canceled before it has a chance to run.
const schedule = require('node-schedule');
const job = schedule.scheduleJob('42 * * * *', function(){
console.log('The answer to life, the universe, and everything!');
});
job.cancel();
Rescheduling a Job
This feature allows you to reschedule an existing job. In this example, the job is rescheduled to run at the 10th minute of every hour.
const schedule = require('node-schedule');
const job = schedule.scheduleJob('42 * * * *', function(){
console.log('The answer to life, the universe, and everything!');
});
job.reschedule('10 * * * *');
Scheduling a Job with Recurrence Rule
This feature allows you to schedule a job using a recurrence rule. In this example, the job is scheduled to run at 5:42 PM on weekdays and Sundays.
const schedule = require('node-schedule');
const rule = new schedule.RecurrenceRule();
rule.dayOfWeek = [0, new schedule.Range(1, 5)];
rule.hour = 17;
rule.minute = 42;
const job = schedule.scheduleJob(rule, function(){
console.log('The answer to life, the universe, and everything!');
});
node-cron is a lightweight task scheduler in pure JavaScript for Node.js based on the cron syntax. It is similar to node-schedule but focuses solely on cron-like scheduling without additional features like recurrence rules.
agenda is a light-weight job scheduling library for Node.js that uses MongoDB for persistence. It offers more advanced features like job prioritization, job concurrency, and job persistence, making it more suitable for complex scheduling needs compared to node-schedule.
bree is a job scheduler for Node.js with a focus on simplicity and performance. It uses worker threads to run jobs in parallel and supports cron syntax. It is more modern and performant compared to node-schedule.
npm install --save @types/node-schedule
This package contains type definitions for node-schedule (https://github.com/node-schedule/node-schedule).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-schedule.
These definitions were written by Cyril Schumacher, Florian Plattner, Tieu Philippe Khim, and Seohyun Yoon.
FAQs
TypeScript definitions for node-schedule
The npm package @types/node-schedule receives a total of 126,559 weekly downloads. As such, @types/node-schedule popularity was classified as popular.
We found that @types/node-schedule demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.