Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
lcherone-task-queue
Advanced tools
This library provides a simple task queue for handling asynchronous tasks. Which uses a basic interval timer and fastq.
To install lcherone-task-queue
, run the following command:
npm i lcherone-task-queue
To use lcherone-task-queue
, follow these steps:
lcherone-task-queue
library:const Tasks = require('lcherone-task-queue')
Tasks
class:const tasks = new Tasks()
Tasks
instance:tasks.add(
// Name of the task queue
'email',
{
// The finder function should return a list of jobs as a Promise
finder: () => {
return Promise.resolve(Array.from({ length: 10000 }, (_, i) => i + 1))
},
// The job worker, gets passed the single item should callback
worker: function (input, cb) {
// Log the input to the console
console.log('worker', input)
// Call the callback with a null error and the result of the job (in this case, the input multiplied by 2)
cb(null, input * 2)
},
// The success handler, handles if the single job item completed
onSuccess: (input, result) => {
// Log the result and input to the console
console.log('onSuccess', result, input)
},
// The error handler, handles if the single job item failed
onError: (input, err) => {
// Log the error and input to the console
console.log('onError', err, input)
},
// The interval in ms on when to fire the job finder
interval: 1000
}
)
tasks.run()
finder
: A function that returns a Promise resolving to a list of jobs.worker
: A function that processes a single job item. It should accept two arguments: input
(the job item) and cb
(a callback function). The callback should be called with two arguments: err
(an error if one occurred) and result
(the result of the job).onSuccess
: A function that is called when a job item is successfully processed. It should accept two arguments: input
(the job item) and result
(the result of the job).onError
: A function that is called when an error occurs while processing a job item. It should accept two arguments: input
(the job item) and err
(the error).interval
: The interval in milliseconds at which to run the finder
function.FAQs
A simple wrapper for fastq
The npm package lcherone-task-queue receives a total of 0 weekly downloads. As such, lcherone-task-queue popularity was classified as not popular.
We found that lcherone-task-queue demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.