{"id":10522,"library":"async-iterators","title":"Utility Functions for Callback-based Async Iterators","description":"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.","status":"abandoned","version":"0.2.2","language":"javascript","source_language":"en","source_url":"https://github.com/mirkokiefer/async-iterators","tags":["javascript"],"install":[{"cmd":"npm install async-iterators","lang":"bash","label":"npm"},{"cmd":"yarn add async-iterators","lang":"bash","label":"yarn"},{"cmd":"pnpm add async-iterators","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS-only and does not support ES modules. The default export is an object containing all utility functions.","wrong":"import * as iterators from 'async-iterators'","symbol":"iterators","correct":"const iterators = require('async-iterators')"},{"note":"Individual functions can be destructured from the CommonJS `require` result, but direct ESM imports are not supported.","wrong":"import { forEach } from 'async-iterators'","symbol":"forEach","correct":"const { forEach } = require('async-iterators')"},{"note":"This package exports an object with properties; individual functions are accessed via dot notation or CommonJS destructuring.","wrong":"import { map } from 'async-iterators'","symbol":"map","correct":"const map = require('async-iterators').map"}],"quickstart":{"code":"const iterators = require('async-iterators');\n\n// A dummy async iterator following the package's callback-based pattern\nfunction createExampleIterator() {\n  let i = 0;\n  const data = [10, 20, 30, 40, 50];\n  return {\n    next: function(cb) {\n      if (i < data.length) {\n        setTimeout(() => {\n          cb(null, data[i]);\n          i++;\n        }, 50);\n      } else {\n        cb(null, undefined); // Signal end of iteration\n      }\n    }\n  };\n}\n\nconst myIterator = createExampleIterator();\n\nconsole.log('Starting iteration...');\niterators.forEach(myIterator, function(err, data) {\n  if (err) {\n    console.error('Error:', err);\n    return;\n  }\n  if (data !== undefined) {\n    console.log('Received data:', data);\n  }\n}, function() {\n  console.log('End of iteration.');\n});","lang":"javascript","description":"Demonstrates the use of `forEach` with a custom callback-based async iterator, logging each item and an 'end' message."},"warnings":[{"fix":"Migrate to native async iterators and modern async/await patterns, or use a contemporary library that provides similar utilities for `AsyncIterable`.","message":"This 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.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Avoid using this package in modern Node.js projects. Consider `data-async-iterators` or `buffered-async-iterable` for modern async iterable utilities.","message":"The 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.","severity":"gotcha","affected_versions":">=0.1.0"},{"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.","message":"This 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.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.10':95 '0.2.2':88 '10':119 '2013':80 'abandon':134 'async':7,35 'asynchron':26,140 'avail':77 'await':106 'base':6,25 'call':68 'callback':5,24,54 'callback-bas':4,23 'cb':45,48,69 'consid':133 'context':33 'current':82 'custom':22 'data':66,75 'decad':130 'defin':38 'ecmascript':101 'engin':147 'err':52 'es2018':113 'extens':144 'filter':18 'for-await-of':104 'foreach':15 'function':2,13,51 'fundament':136 'incompat':137 'item':62 'iter':8,27,36 'javascript':150 'legaci':92 'librari':31,90 'like':14 'map':16 'method':46,57 'modern':139 'nativ':100,115 'next':44,56,61 'node.js':93,118 'null':70 'object':41 'packag':10 'paradigm':142 'pattern':28 'predat':98 'program':141 'provid':11 'publish':78 're':146 're-engin':145 'return':59 'seen':124 'signific':97 'sourc':67 'specif':21 'stabl':85 'standard':111 'support':116 'symbol.asynciterator':102 'syntax':108 'target':91 'undefin':71 'under':65 'updat':126 'util':1,12 'valu':53 'version':86,94 'without':143 'wrapper':149 'x':120","created_at":"2026-04-19T13:33:15.794899+00:00","updated_at":"2026-04-19T13:33:15.794899+00:00","problems":[{"fix":"Ensure you are using CommonJS `require` syntax: `const iterators = require('async-iterators');`.","cause":"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.","error":"TypeError: iterators.forEach is not a function"},{"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.","cause":"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).","error":"ReferenceError: require is not defined in ES module scope"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/async-iterators","openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}