1.2.0 • Published 3 months ago

reader-line-iterator v1.2.0

Weekly downloads
96
License
BSD-2-Clause
Repository
github
Last release
3 months ago

npm License Typed with TypeScript bundlejs downloads GitHub Issues Build Status Styled with prettier Commitizen friendly Known Vulnerabilities Coverage Status

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)
  • decoder TextDecoder (optional, default new TextDecoder())

Returns AsyncIterator[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) extracted lines

install

With npm do:

npm install reader-line-iterator

license

BSD-2-Clause

1.2.0

3 months ago

1.1.6

11 months ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

4 years ago