Registry / http-networking / async-iterators

async-iterators

JSON →
library0.2.2jsnpmunverified

This package provides utility functions like `forEach`, `map`, and `filter` for a specific, custom, callback-based asynchronous iterator pattern. In this library's context, an async iterator is defined as an object with a `next(cb)` method, where `cb` is a `function(err, value)` callback. The `next` method should return the next item from an underlying data source, calling `cb(null, undefined)` when no more data is available. Published in 2013, its current and only stable version is 0.2.2. The library targets legacy Node.js versions (>=0.10) and significantly predates the native ECMAScript `Symbol.asyncIterator` and `for-await-of` syntax, which were standardized in ES2018 and natively supported in Node.js 10.x. As it has seen no updates in over a decade, it is considered abandoned and fundamentally incompatible with modern asynchronous programming paradigms without extensive re-engineering or wrappers.

npm install async-iterators
INSTALL
IMPORT
SIG · ASYNC-ITERATORS
A
async-iterators
http-networkingjavascriptv0.2.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

iterators
const iterators = require('async-iterators')
import * as iterators from 'async-iterators'
This package is CommonJS-only and does not support ES modules. The default export is an object containing all utility functions.
forEach
const { forEach } = require('async-iterators')
import { forEach } from 'async-iterators'
Individual functions can be destructured from the CommonJS `require` result, but direct ESM imports are not supported.
map
const map = require('async-iterators').map
import { map } from 'async-iterators'
This package exports an object with properties; individual functions are accessed via dot notation or CommonJS destructuring.

Demonstrates the use of `forEach` with a custom callback-based async iterator, logging each item and an 'end' message.

const iterators = require('async-iterators'); // A dummy async iterator following the package's callback-based pattern function createExampleIterator() { let i = 0; const data = [10, 20, 30, 40, 50]; return { next: function(cb) { if (i < data.length) { setTimeout(() => { cb(null, data[i]); i++; }, 50); } else { cb(null, undefined); // Signal end of iteration } } }; } const myIterator = createExampleIterator(); console.log('Starting iteration...'); iterators.forEach(myIterator, function(err, data) { if (err) { console.error('Error:', err); return; } if (data !== undefined) { console.log('Received data:', data); } }, function() { console.log('End of iteration.'); });
Debug
Known issues
breakingThis package uses a custom callback-based async iterator pattern that is fundamentally different from the native ECMAScript `Symbol.asyncIterator` protocol (ES2018). It is not compatible with `for-await-of` loops or modern Promise-based async/await syntax.
fix
Migrate to native async iterators and modern async/await patterns, or use a contemporary library that provides similar utilities for `AsyncIterable`.
affects: >=0.1.0
gotchaThe package was last updated over a decade ago (version 0.2.2 published in 2013) and targets Node.js versions >=0.10. It is highly unlikely to be compatible with current Node.js runtimes (e.g., Node.js 16+ or 20+) without significant environment setup or polyfills for ancient Node.js APIs.
fix
Avoid using this package in modern Node.js projects. Consider `data-async-iterators` or `buffered-async-iterable` for modern async iterable utilities.
affects: >=0.1.0
gotchaThis library is CommonJS-only and does not support ES Modules (`import`/`export` syntax). Attempting to import it directly in an ESM context will result in errors.
fix
In an ESM project, you would need to use `const iterators = require('async-iterators')` within a CommonJS wrapper, or refactor to use a modern ESM-compatible async utility library.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: iterators.forEach is not a function
Attempting to use `async-iterators` in an ES module context with `import` syntax, or the variable holding the `require` result is not named `iterators` or correctly destructured.
fix
Ensure you are using CommonJS `require` syntax: `const iterators = require('async-iterators');`.
ReferenceError: require is not defined in ES module scope
Trying to use `require` in a JavaScript file explicitly defined as an ES module (e.g., via `"type": "module"` in `package.json` or `.mjs` extension).
fix
This package is not compatible with ES module projects. You must either convert your project to CommonJS or choose a modern async iterator library that supports ES modules.
Upgrade
Version history
0.2.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
14
OpenAI (training)
1
Resources
async-iterators — npm install async-iterators · libregistry