Registry / storage / pull-queue

pull-queue

JSON →
library0.1.4jsnpmunverified

A pull-stream based duplex stream with a built-in queue, version 0.1.4, maintained for the pull-stream ecosystem. It allows transforming or validating data as it passes through, with options like sendMany to split arrays into multiple items. Designed to avoid null reads by returning a duplex stream. Lightweight, no dependencies, and integrates seamlessly with other pull-stream utilities.

npm install pull-queue
INSTALL
IMPORT
SIG · PULL-QUEUE
P
pull-queue
storagejavascriptv0.1.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

queue
import queue from 'pull-queue'
const { queue } = require('pull-queue')
Default export only; named import will be undefined.
queue
const queue = require('pull-queue')
const pullQueue = require('pull-queue').queue
CommonJS users must use default require, not destructuring.
Type
import type { Duplex } from 'pull-stream'
const Duplex = require('pull-queue').Duplex
pull-queue does not export TypeScript types; use pull-stream types.

Demonstrates a queue stream that filters out non-numeric values using a validation function.

const pull = require('pull-stream'); const queue = require('pull-queue'); // Validate data: only allow numbers const validate = queue(function(end, data, cb) { if (end) return cb(end); if (typeof data === 'number') cb(null, data); else cb(); // skip invalid }); pull( pull.values([1, 'a', 2, 'b', 3]), validate, pull.collect((err, results) => { console.log(results); // [1, 2, 3] }) );
Debug
Known issues
gotchaCallback with no arguments (cb()) silently drops the data; this is by design but can be non-obvious.
fix
Ensure that the callback is called with valid data or null to skip, not undefined.
affects: >=0.0.0
gotchaWhen sendMany is true, the callback can receive an array, and each element is emitted individually. If you pass a single array item, it may be treated as multiple items.
fix
Set sendMany: false (default) when you want to pass arrays as single items.
affects: >=0.0.0
deprecatedNo deprecation warnings in current version, but the package uses older pull-stream patterns and may not be maintained for future pull-stream changes.
fix
Monitor for updates or consider alternatives like pull-through or pull-transform.
affects: 0.1.4
Errors
Common errors & fixes
Error: queue is not a function
Using named import instead of default import (e.g., import { queue } from 'pull-queue').
fix
Use default import: import queue from 'pull-queue' (ESM) or const queue = require('pull-queue') (CJS).
TypeError: cb is not a function
Passing wrong arguments to the queue function; the transform function expects (end, data, cb).
fix
Ensure the transform function signature is exactly (end, data, cb), not (data, cb) or (end, data).
Unhandled stream error: [object Object]
Throwing an error inside the transform function instead of passing it to callback.
fix
Use cb(error) to pass errors back to the pull-stream pipeline; do not throw.
Upgrade
Version history
0.1.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
pull-queue — npm install pull-queue · libregistry