# readlines

> Read file line as array

Latest version **0.2.0** (published 2015-11-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install readlines
pnpm add readlines
yarn add readlines
bun add readlines
```

Provides the command `readlines`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2015-11-20 |
| First published | 2013-12-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.36 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | liucw |
| Maintainers | booxood |
| Keywords | readfile, readlines, readline |

## Links

- npm: https://www.npmjs.com/package/readlines
- Repository: https://github.com/booxood/readlines
- Homepage: https://github.com/booxood/readlines#readme
- Issues: https://github.com/booxood/readlines/issues
- npm.io page: https://npm.io/package/readlines

## Dependencies (1)

- [commander](https://npm.io/package/commander.md) ~2.1.0

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2015-11-20
- 0.1.0 — 2015-04-07
- 0.0.8 — 2014-01-09
- 0.0.6 — 2013-12-13
- 0.0.2 — 2013-12-10
- 0.0.1 — 2013-12-09

## README

# Readlines


[![Build Status](https://travis-ci.org/booxood/readlines.png?branch=master)](https://travis-ci.org/booxood/readlines)
[![Coverage Status](https://coveralls.io/repos/booxood/readlines/badge.svg)](https://coveralls.io/r/booxood/readlines)


Read file line as array.

## Install

```
npm install readlines
```
or
```
npm install -g readlines
```

Example:
```javascript
  var rl = require('readlines');
  var lines = rl.readlinesSync('example.txt');
  for(var line in lines){
    console.log(lines[line]);
  };
```


## API

### readlinesSync(filename, [options])
Sync read file by line return an array.
```javascript
  var lines = rl.readlinesSync(filePath);
```

### readlines(filename, [options], callback)
**Async** read file by line return an array.
```javascript
  rl.readlines(filePath, function(err, lines){
      console.log(lines);
  });
```

### readlineSync(filename, [options], lineNum)
Sync read file by line return specific line.
```javascript
  var line = rl.readlineSync(filePath, 3);
```

### readline(filename, [options], lineNum, callback)
**Async** read file by line return specific line.
```javascript
  rl.readline(filePath, 3, function(err, line){
      console.log(line);
  });
```

### readlinesStream()
Read by line as stream.
```javascript
  var liner = rl.readlinesStream();

  fs.createReadStream(filePath)
      .pipe(liner)
      .on('readable', function() {
          var line;
          while (line = liner.read()) {
              console.log(line);
          }
      });
```


## License
[The MIT License](https://github.com/booxood/readlines/blob/master/LICENSE)

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