
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A simple file system based queuing implementation. Based on the maildir format, the queues are lockfree and therefore work in most situatuions. Look here for the maildir specification. The queue organises everything in FIFO (first-in first-out) order, because of that it is not possible to get the messages of the queue with random access. All objects are encoded using json and therefore can be easily read manually.
This queuing library has a specialty, its supports transactions for popping items.
The queue is created based on a folder. The passed folder will contain have
three directories cur, tmp and new. The names of the files follow the
maildir conventions.
var Queue = require('file-queue').Queue,
queue = new Queue('.', callback);
If you deal with lots of files EMFILE errors (too many open files errors)
can occur. Issacs wrote the graceful-fs package to deal with these errors.
To use it simply pass the filesystem library that you prefer:
var queue = new Queue({
path: 'tmp',
fs: require('graceful-fs')
}, done);
Popping a message can be done at any time. If the queue doesn't contain an item at the
moment it 'blocks' until it does. If there was an error, while removing the
message err will contain an error message.
queue.pop(function(err, message) {
if (err) throw err;
console.log(message);
});
Pushing an item into the queue could cause an error if e.g. no disk space is left on the device.
queue.push('Hello World', function(err) {
if (err) throw err;
});
The queue length can easily be determined with the following call:
queue.length(function(err, length) {
console.log(length);
});
A transactional pop means, that the element is taken from the queue, but will not be removed until commit is called. The rollback action makes the item again available for popping.
queue.tpop(function(err, message, commit, rollback) {
if (Processor.process(message) === true) {
commit(function(err) { if (err) throw err; });
} else {
rollback(function(err) { if (err) throw err; });
}
});
There can be multiple layers of transactions. Since transactional pops (tpops) don't block the popping in general, there can be multiple inside of each other. The downside is that it can't be assured that the messages are processed in order.
To remove all items from a queue, for example for testing purposes, use clear.
queue.clear(function(err) { if (err) throw err; });
FAQs
A file system based queue (implemented using maildir)
The npm package file-queue receives a total of 426 weekly downloads. As such, file-queue popularity was classified as not popular.
We found that file-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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.