0.1.1 • Published 7 years ago

async-file-reader v0.1.1

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

Asynchronous File Reader

Greenkeeper badge Build Status Coverage Status Known Vulnerabilities

File reader allows to read a file line by line. The advantage by this module is that you can write your asynchronous code in a linear way. That reduces the complexity of code. Using readFileSync could become complicated, when you should handle large files.

Another feature is, that if you do not add a callback with readLine() the stream is posed and will not waste memory.

Usage

const main = async () => {
    import {AsyncFileReader} from 'async-file-reader';
    const fileReader = new AsyncFileReader('README.md');
    let line: string;
    try {
        while ((line = await fileReader.readLine()) != null) {
            // do something
        } 
    } catch (error) {
        console.log('An Error happened while reading the file.');
    }
}

main()
    .catch(() => /* handle error in main function */ );
0.1.1

7 years ago

0.1.0

7 years ago

0.0.23

7 years ago

0.0.22

7 years ago

0.0.21

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.1

7 years ago