Licence
0BSD
Version
1.2.3
Deps
0
Size
7 kB
Vulns
0
Weekly
0
reader-line-iterator
Convert a reader into a async iterator emitting text lines
import { lineIterator } from "reader-line-iterator";
const result = await fetch("http://somewhere/mytext.txt");
for await (const line of lineIterator(result.body.getReader())) {
console.log(line);
}
API
Table of Contents
lineIterator
Extracts lines from a reader and delivers them as an async iterator.
Parameters
reader(ReadableStreamDefaultReader | ReadableStreamBYOBReader)decoderTextDecoder (optional, defaultnew TextDecoder())
Returns AsyncIterable<string> extracted lines
install
With npm do:
npm install reader-line-iterator
license
BSD-2-Clause