Gathering detailed insights and metrics for @teamteanpm2024/iste-voluptatum-iste
Gathering detailed insights and metrics for @teamteanpm2024/iste-voluptatum-iste
npm install @teamteanpm2024/iste-voluptatum-iste
Typescript
Module System
Node Version
NPM Version
49.8
Supply Chain
76.4
Quality
79.8
Maintenance
100
Vulnerability
100
License
Cumulative downloads
Total Downloads
Last day
0%
0
Compared to previous day
Last week
0%
0
Compared to previous week
Last month
0%
0
Compared to previous month
Last year
0%
0
Compared to previous year
37
Given a MongoDB query cursor, process the results in parallel, up to the specified limit.
1var @teamteanpm2024/iste-voluptatum-iste = require('@teamteanpm2024/iste-voluptatum-iste'); 2var cursor = mongoCollection.find({}); 3 4return @teamteanpm2024/iste-voluptatum-iste(cursor, 8, function(doc, callback) { 5 // Up to 8 of these will be invoked simultaneously 6 // Do something with doc, then... 7 return callback(null); 8}, function(err) { 9 // All done 10});
We wanted to work with MongoDB queries the way we work with async.eachLimit, but without yanking everything into memory at once with toArray
.
Specifically, we wanted to resize some images in parallel, rather than waiting to do them one at a time. We have a MongoDB collection with information about all of the images. But there are a lot of them, so we don't want to yank all of that information into memory up front.
@teamteanpm2024/iste-voluptatum-iste
wraps MongoDB's Cursor.nextObject
with a queueing mechanism that allows several results to be processed at once, but only up to the limit you specify. You don't run out of memory due to too many image processes, you don't wait too long, and you don't have to load the entire array into memory at once. Everybody gets a medal.
If an error occurs, @teamteanpm2024/iste-voluptatum-iste
will:
You can pass any object with a nextObject
method as the "cursor." That method should invoke its callback with (err, object)
. If there is no error, object
should be the next object retrieved from your data source. If there are no more objects, pass null
as object
.
@teamteanpm2024/iste-voluptatum-iste
was created at P'unk Avenue for use in many projects built with Apostrophe, an open-source content management system built on node.js. If you like @teamteanpm2024/iste-voluptatum-iste
you should definitely check out apostrophecms.com.
Feel free to open issues on github.
next
and nextObject
methods.npm audit
.@teamteanpm2024/iste-voluptatum-iste
to invoke its final callback more than once.No vulnerabilities found.
No security vulnerabilities found.