Skip to content

Convenient line-by-line reading from a stream on node. 💻

License

Notifications You must be signed in to change notification settings

Authory/async-read-line

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Async Read Line

This library provides a convenient way to read line-wise from streams.

Installation

yarn add async-line-reader
# or
npm i async-line-reader

Usage and Examples

Read line-wise from a stream:

const reader = new AsyncLineReader(stream)

let line: string | null

// Read each line until the stream ends.
for((line = await reader.readLine() !== null) {
  // ... do something with line.
}

Custom separator or encoding:

const reader = new AsyncLineReader(stream, ';', 'ascii')

const line = await reader.readLine()

For more detailed examples, please look into the examples and test folders.

Why should I use this?

This module is for your convienence if you want to read a stream line by line in a JS application that utilizes async/await. I did not see another library that proided a similar, convenient interface.

About

Convenient line-by-line reading from a stream on node. 💻

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published