# count-lines-in-file

> Counts the number of lines in a file.

Latest version **1.1.0** (published 2017-03-26) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install count-lines-in-file
pnpm add count-lines-in-file
yarn add count-lines-in-file
bun add count-lines-in-file
```

## 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.1.0 |
| Published | 2017-03-26 |
| First published | 2016-05-08 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 5.0.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Gajus Kuizinas |
| Maintainers | gajus |
| Keywords | wc, count lines |

## Links

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

## Dependencies (1)

- [split](https://npm.io/package/split.md) ^1.0.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2017-03-26
- 1.0.2 — 2016-05-08
- 1.0.1 — 2016-05-08
- 1.0.0 — 2016-05-08

## README

# `countLinesInFile`

[![NPM version](http://img.shields.io/npm/v/count-lines-in-file.svg?style=flat-square)](https://www.npmjs.org/package/count-lines-in-file)
[![Travis build status](http://img.shields.io/travis/gajus/count-lines-in-file/master.svg?style=flat-square)](https://travis-ci.org/gajus/count-lines-in-file)
[![js-canonical-style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical)

Counts the number of lines in a file using [`fs.createReadStream`](https://nodejs.org/api/fs.html#fs_fs_createreadstream_path_options) and [`split`](https://github.com/dominictarr/split).

```js
const countLinesInFile = require('count-lines-in-file');
const path = require('path');
const targetFilePath = path.resolve(__dirname, './data.txt');

countLinesInFile(targetFilePath, (error: Error, numberOfLines: number) => {

});
```

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