Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
async-timed-cargo
Advanced tools
An lib to periodically flush a collection with a limited size based on async.cargo
Readme
async.cargo based task execution.
Async.cargo:
async-timed-cargo
add async-timed-cargo
to you package.json
var asyncTimedCargo = require('async-timed-cargo');
var cargo = asyncTimedCargo(function(tasks, callback) {
// the tasks array will be [1, 2, 3]
// this will be called after 1000ms, as number of items (3) is smaller than payload (10)
callback('err', 'arg');
}, 10, 1000);
asyncTimedCargo.push(1);
asyncTimedCargo.push(2);
asyncTimedCargo.push(3, function(err, arg) {
// err will be 'err'
// arg will be 'arg'
});
Also, check the example app for a working example on how to use the middleware
Arguments
worker(tasks, callback)
- An asynchronous function for processing an array of
queued tasks, which must call its callback(err, arg)
argument when finished, with an optional err
and arg
argument.payload
- An optional integer
for determining how many tasks should be
processed per round; if omitted, the default is unlimited and only timer will be consideredtimeout
- An optional integer
for determining the interval (in ms) to be used to flush data each round; if omitted, the default is 1000msCargo objects
The cargo
object returned by this function has the following properties and
methods:
length()
- A function returning the number of items waiting to be processed.push(task, [callback])
- Adds task
to the queue
. The callback is called
once the worker
has finished processing the task. Instead of a single task, an array of tasks
can be submitted. The respective callback is used for every task in the list.$ npm install
$ npm test
FAQs
An lib to periodically flush a collection with a limited size based on async.cargo
The npm package async-timed-cargo receives a total of 472 weekly downloads. As such, async-timed-cargo popularity was classified as not popular.
We found that async-timed-cargo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.