1.0.1 • Published 6 years ago

ai-from-stream v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

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

1.0.1

6 years ago

1.0.0

6 years ago

0.0.1

6 years ago