2.0.0 • Published 5 years ago

rmlines v2.0.0

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

rmlines Build Status Travis codecov

Streaming line remover

rmlines is a Transform stream that remove lines (based on line numbers) from any string.

Install

$ npm install --save rmlines

Usage

Suppose a file named example.txt containing the following:

abc
def
ghi
jkl
mno

then, rmlines() returns a transform stream that accepts strings and emits the string without unwanted lines (here: line 2 and line 4)

const rmlines = require('rmlines');
let txt = '';

fs.createReadStream('example.txt')
  .pipe(rmlines([2, 4]))
  .on('data', function (data) {
    txt += data;
  }).on('end', function () {
    console.log((txt === 'abc\nghi\nmno\n'));
    // => true
  });

Options

maxLength

Type: integer

Set a buffer size limit.

API

rmlines(lines, options)

lines

Type: integer|array

The number(s) of the line(s) that must be removed.

options

Type: object as described above

Related

License

MIT © t1st3

2.0.0

5 years ago

1.0.0

6 years ago

0.2.0

6 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago