ai-event
Create an async iterable from an event emitter.
This module transform an event emitter into an async iterable.
Async iterable fun
This module is part of
Async iterable fun, a complete toolset of
modules to work with async iterables.
Usage
Transform a node stream into an aync iterable:
const fromEvent = require("ai-event");
import { createReadStream } from "fs";
const stream = createReadStream("aFile", "utf8");
const iterable = fromEvent(stream, "data");
for await (const chunk of iterable) {
console.log(chunk);
}
This will output aFile content
API
Install
With npm installed, run
npm install --save ai-event
See Also
License
MIT