New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

dpwm-queue

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dpwm-queue

A simple array-backed queue with parallel worker-based consumption. It is useful for io-bound tasks that can be parallelised, such as parallel downloads using p workers.

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

dpwm-queue

A simple array-backed queue with parallel worker-based consumption. It is useful for io-bound tasks that can be parallelised, such as parallel downloads using p workers.

Usage

Putting items into the queue

Items are put in either at construction:

import { Queue } from "dpwm-queue";
const q = new Queue([1, 2, 3]);

or using push:

import { Queue } from "dpwm-queue";
const q = new Queue();
q.push(1);
q.push(2);

Iterating over the queue

Items are never removed; they are designed to be iterated over using pForEach.

pForEach is a parallel forEach. It takes an async function as a callback.

Warning: this does not free up memory as items are consumed.

import { Queue } from "dpwm-queue";
const q = new Queue([1, 2, 3]);
q.close(); // The queue can be left open, which can be useful.

await q.pForEach(
    async (x, n) => {},
    2 // Number of workers. Default is 1.
    );

FAQs

Package last updated on 09 May 2025

Did you know?

Socket

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.

Install

Related posts