# line-puller

> This is simply a small node.js module to read a file line by line in a controlled, imperative way.

Latest version **1.0.1** (published 2019-10-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install line-puller
pnpm add line-puller
yarn add line-puller
bun add line-puller
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-10-25 |
| First published | 2019-10-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | jsanchesleao |

## Links

- npm: https://www.npmjs.com/package/line-puller
- npm.io page: https://npm.io/package/line-puller

## Recent versions

- 1.0.1 (latest) — 2019-10-25
- 1.0.0 — 2019-10-25

## README

# Line Puller

This is simply a small node.js module to read a file line by line in a controlled, imperative way.

## Installation

```bash
$ npm install line-puller --save
```

## How to use

```js
const LinePuller = require('line-puller');

(async function() {

  const lineReader = new LinePuller(__filename);
  lineReader.addFilter( line => line.trim().length > 0 );
  
  await lineReader.skip(1);
  
  for(let line = await lineReader.nextLine(); 
      line !== LinePuller.EOF;
      line = await lineReader.nextLine()) {

    console.log(line);
  }

}());

```

You need to instantiate a LinePuller, passing the filepath or a readableStream as an argument.

There are only three methods available in the LinePuller class: `nextLine` returns, as expected, the next line of the file as a string; `skip` accepts a number and skips that amount of lines; and `addFilter`, which accepts a filter function (as one you would pass to the Array.filter function).

When the LinePuller instance runs out of source lines, it will start returning `LinePuller.EOF` as result from `nextLine` method.

---
_Source: https://npm.io/package/line-puller · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
