1.1.0 • Published 12 months ago

domany v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

DoMany

A simple package that runs multiple functions efficiently

Example (Get 100 dog pics):

Asynchronous:

const doMany = require("domany");

(async () => {
    let arr = new Array(100).fill("https://dog.ceo/api/breeds/image/random");

    let res = await doMany(arr, async (url) => { return await (await fetch(url)).json() }, { maxRetries: 0, amountPerUnit: arr.length / 10, events: false});
    
    console.log(res);
})();

With events:

const doMany = require("domany");

(async () => {
    let arr = new Array(100).fill("https://dog.ceo/api/breeds/image/random");

    let res = await doMany(arr, async (url) => { return await (await fetch(url)).json() }, { maxRetries: 0, amountPerUnit: arr.length / 10, events: true });
    
    res.on("data", console.log);

    res.on("done", data =>{
        console.log("Finished with " + data.length + " dog images");
    })
})();
1.1.0

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago