1.0.8 • Published 6 years ago

promise-readline v1.0.8

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

promise-readline

read a file or stdin line by line in promise style.

Install

npm install promise-readline --save

Usage

// JFK.txt
We choose to go to the moon in this decade and do the other things,
not because they are easy, 
but because they are hard.
const lineReader = require('promise-readline');
const fs = require('fs');

(async () => {
    //for stdin use: let lr = LineReader(process.stdin);
    let lr = lineReader(fs.createReadStream('JFK.txt'));

    await lr.readLine(); // We choose to go to the moon in this decade and do the other things,
    await lr.readLine(); // not because they are easy,
    await lr.readLine(); // but because they are hard.
    await lr.readLine(); // undefined

    lr.close();
})()
.catch(console.error);
1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago