Socket
Socket
Sign inDemoInstall

firstline

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

firstline

Async npm module for Node JS that reads the first line of a file


Version published
Maintainers
1
Created
Source

Firstline

Travis David npm

Introduction

Firstline is a npm async module for NodeJS, that reads and returns the first line of any file. It uses native JS promises and streams (requires Node >= v4.0.0). It is well tested and built for high performance.

It is particularly suited when you need to programmatically access the first line of a large amount of files, while handling errors if they occur.

Install

npm install firstline

(add "--save" if you want the module to be automatically added to your project's "package.json" dependencies)

var firstline = require(firstline)

API

firstline(filepath)

Incrementally reads data from "filepath" until it reaches the end of the first line. Returns a promise, eventually fulfilled with a string.

// Imagine the file content is:
// abc
// def
// ghi
//

firstline('./my-file.txt')
// -> Returns a promise that will be fulfilled with: 'abc'

MIT License

Keywords

FAQs

Package last updated on 09 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc