ai-from-stream

1.0.1 • Public • Published

ai-from-stream

Travis Build Status NPM downloads

create an async iterable from a stream

This module convert an instance of readable node Stream into an async iterable.

Usage

Write content of a file in a for loop:

import fromStream from ".";
import { createReadStream } from "fs";
 
const stream = createReadStream(`file.txt`, "utf8");
for await (const chunk of fromStream(stream)) {
  console.log(chunk);
}

This will output the content of file.txt file

API

aiFromStream

Create an async iterable from a stream

Parameters

  • stream ReadableStream the stream to transform

Returns AsyncIterable converted iterator

Install

With npm installed, run

npm install --save ai-from-stream

See Also

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i ai-from-stream

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • parroit