reverse-read-line
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Build Status Coverage Status

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

Readme

Keywords

Package Sidebar

Install

npm i reverse-read-line

Weekly Downloads

4

Version

0.2.0

License

ISC

Unpacked Size

12.3 kB

Total Files

11

Last publish

Collaborators

  • wmzy