andressrg / zqueue

Queue and run promise based jobs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZQueue

Queue and run promise based jobs. Can be used to control the use of resources like upload bandwith effectively.

Example

import { ZQueue } from 'zqueue';
import axios from 'axios';

const queue = new ZQueue({ max: 3 });

queue.run(() => axios.put(myUrl1, file1));
queue.run(() => axios.put(myUrl2, file2));
queue.run(() => axios.put(myUrl3, file3));
queue.run(() => axios.put(myUrl4, file4));
queue.run(() => axios.put(myUrl5, file5));

// A maximum of 3 uploads will be ran at the same time.

About

Queue and run promise based jobs


Languages

Language:JavaScript 100.0%