first-line

4.0.0 • Public • Published

first-line

Get the first line of a file.

Example

$ cat fixture.txt
1
2
3
var firstLine = require('first-line');
var path = require('path');

var p = path.resolve(__dirname, 'fixture.txt');

firstLine(p, function(error, line) {
  if (error) {
    throw error;
  }

  console.log(line.toString());
  // => '1'
});

Installation

$ npm install first-line

API

var firstLine = require('first-line');

firstLine(file, callback)

Reads the file at String file and calls callback(error, line), where error is any Error encountered and line is a Buffer of the first line of file.

Readme

Keywords

Package Sidebar

Install

npm i first-line

Weekly Downloads

18

Version

4.0.0

License

MIT

Unpacked Size

3.62 kB

Total Files

4

Last publish

Collaborators

  • kenan