# process-file-lines

> Process the lines in a file

Latest version **1.0.3** (published 2020-04-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install process-file-lines
pnpm add process-file-lines
yarn add process-file-lines
bun add process-file-lines
```

## 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.3 |
| Published | 2020-04-04 |
| First published | 2019-08-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | pcw@case.edu |
| Maintainers | paulwhitten |

## Links

- npm: https://www.npmjs.com/package/process-file-lines
- Repository: https://github.com/paulwhitten/process-file-lines
- Homepage: https://github.com/paulwhitten/process-file-lines#readme
- Issues: https://github.com/paulwhitten/process-file-lines/issues
- npm.io page: https://npm.io/package/process-file-lines

## Recent versions

- 1.0.3 (latest) — 2020-04-04
- 1.0.2 — 2020-04-04
- 1.0.1 — 2019-12-29
- 1.0.0 — 2019-08-13

## README

# process-file-lines

Processes a file by lines.  Calls the callback for each line in the file,
passing the line without the line break.

Corresponding with the behavior of readline, if the final line is merely
a line break sequence, the callback will not be invoked.

## API
This module exports a single function `(fileName, cb)` taking
 * `fileName` is a string representing the file name
 * `cb` is a callback taking one parameter, a string representing a line

 The function returns a promise that resolves upon completion of reading the file
 and rejects in the event of an error, passing the error.

## Use

An example of use that counts the number of lines in a file.
```
const processFileLines = require('process-file-lines');

let count = 0;
processFileLines('../process-file-lines.js', () => {
    count++;
})
    .then(() => {
        console.log('number of lines', count);
    })
    .catch((err) => {
        console.log('Error', err);
    });
```

An example that outputs lines to the console.
```
const processFileLines = require('process-file-lines');

processFileLines('./process-file-lines.js', (line) => {
    console.log(line);
})
    .then(() => {
        console.log('-completed reading file-');
    })
    .catch((err) => {
        console.log('Error', err);
    });
```

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