Async looping for Node.js.

  • lupus

Downloads in past


0.0.110 years ago10 years agoMinified + gzip package size for lupus in KB


NPM Version NPM Downloads Build Status
Async looping for Node.js
Banana Peel Sketch


  • Author: Randall Degges
  • Email:
  • Twitter: @rdegges
  • Site:
  • Status: production ready


To install lupus using npm, simply run:
$ npm install lupus

In the root of your project directory.


Once you have lupus installed, you can use it to easily iterate over a large set of numbers asynchronously (without locking up the CPU!):
var lupus = require('lupus');

lupus(0, 100000, function(n) {
  console.log("We're on:", n);

Want to run some code after the loop is finished? No problem!
var lupus = require('lupus');

lupus(0, 1000000, function(n) {
  console.log("We're on:", n);
}, function() {
  console.log('All done!');

If you were to try the same thing with a typical for loop, you'd use up a TON of memory on your computer, as well as block the Node.js process from executing any other code (bad). Don't believe me? Try running the code sample below yourself =)
for (var i = 0; i < 10000000; i++) {
  console.log("We're on:", i);

console.log('All done!');

Author's Note

I didn't want to call this library lupus, but I didn't really have a choice since looper was already taken! Darn.
I kinda-sorta figured oh well, let's just do this the weird way. Screw it.


v0.0.1: 9-19-2014
- First release!