
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
@types/p-queue
Advanced tools
Stub TypeScript definitions entry for p-queue, which provides its own types definitions
@types/p-queue provides TypeScript type definitions for the p-queue package, which is a promise queue with concurrency control. It allows you to manage the execution of asynchronous tasks, ensuring that a specified number of tasks run concurrently.
Basic Queue Usage
This feature demonstrates how to create a basic queue with a concurrency of 1, meaning tasks will be executed one at a time.
const PQueue = require('p-queue');
const queue = new PQueue({ concurrency: 1 });
queue.add(() => Promise.resolve('Task 1')).then(console.log);
queue.add(() => Promise.resolve('Task 2')).then(console.log);
Concurrency Control
This feature demonstrates how to set a concurrency of 2, allowing two tasks to run concurrently.
const PQueue = require('p-queue');
const queue = new PQueue({ concurrency: 2 });
queue.add(() => new Promise(resolve => setTimeout(() => resolve('Task 1'), 1000))).then(console.log);
queue.add(() => new Promise(resolve => setTimeout(() => resolve('Task 2'), 500))).then(console.log);
queue.add(() => new Promise(resolve => setTimeout(() => resolve('Task 3'), 300))).then(console.log);
Queue Pause and Resume
This feature demonstrates how to pause and resume the queue. Tasks added while the queue is paused will wait until the queue is resumed.
const PQueue = require('p-queue');
const queue = new PQueue({ concurrency: 1 });
queue.add(() => Promise.resolve('Task 1')).then(console.log);
queue.pause();
queue.add(() => Promise.resolve('Task 2')).then(console.log);
queue.add(() => Promise.resolve('Task 3')).then(console.log);
setTimeout(() => queue.start(), 2000);
The async package provides various functions for working with asynchronous JavaScript, including queue management. It offers more utilities beyond just queue management, such as parallel execution, series execution, and more.
The promise-queue package is a lightweight promise queue with concurrency control. It is similar to p-queue but with a simpler API and fewer features.
Bottleneck is a powerful rate limiter that also provides queue functionality. It allows you to control the rate of task execution, making it suitable for scenarios where you need to limit the rate of API calls or other operations.
This is a stub types definition for p-queue (https://github.com/sindresorhus/p-queue).
p-queue provides its own type definitions, so you don't need @types/p-queue installed!
FAQs
Stub TypeScript definitions entry for p-queue, which provides its own types definitions
The npm package @types/p-queue receives a total of 180,612 weekly downloads. As such, @types/p-queue popularity was classified as popular.
We found that @types/p-queue demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.