reverse-read-line
v0.2.0
Published
read text file line by line from end.
Downloads
6
Readme
reverse-read-line
Read text file line by line from end.
install
npm install reverse-read-line
Usage
import * as rrl from 'reverse-read-line';
const reader = rrl.create(filename, options);
const lines = await reader.readLines(2);
await reader.close();
console.log(lines);
stream:
import * as rrl from 'reverse-read-line';
const stream = rrl.createStream(filename, options);
stream.on('data', (line) => {
console.log(line);
});
read lines:
import * as rrl from 'reverse-read-line';
const lines = await rrl.readLines(filename, 5, options);
console.log(lines);
Options:
| name | type | default | description | :--------: | :----: | :-------: | :----- | encoding | string | 'utf8' | the file encoding | bufferSize | number | 4096 | the size will be read once | separator | string | undefined | line separator. if undefined it will auto judging