ai-event

1.1.1 • Public • Published

ai-event

Travis Build Status NPM downloads

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

Readme

Keywords

none

Package Sidebar

Install

npm i ai-event

Weekly Downloads

11

Version

1.1.1

License

MIT

Last publish

Collaborators

  • parroit