{"name":"firstline","version":"1.0.0","description":"Async npm module for Node JS that reads the first line of a file","main":"firstline.js","repository":{"type":"git","url":"https://github.com/pensierinmusica/firstline.git"},"keywords":["read","check","file","content","filesystem","io","stream","async","promise"],"author":{"name":"Alessandro Zanardi"},"license":"MIT","bugs":{"url":"https://github.com/pensierinmusica/firstline/issues"},"homepage":"https://github.com/pensierinmusica/firstline","dependencies":{"q":"^1.2.0"},"devDependencies":{"chai":"^2.1.0","chai-as-promised":"^4.2.0","coveralls":"^2.11.2","istanbul":"^0.3.6","mocha":"^2.1.0","q-io":"^1.11.6","rimraf":"^2.2.8"},"scripts":{"test":"mocha","test-travis":"./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha"},"gitHead":"0d170b9b76ded674b6e36d56a8c71c93940bda01","_id":"firstline@1.0.0","_shasum":"14999b845191e225775ab1731a6b4a11dbf95c49","_from":".","_npmVersion":"2.4.1","_nodeVersion":"1.1.0","_npmUser":{"name":"pensierinmusica","email":"alessandro@zanardi.org"},"maintainers":[{"name":"pensierinmusica","email":"alessandro@zanardi.org"}],"dist":{"shasum":"14999b845191e225775ab1731a6b4a11dbf95c49","tarball":"http://registry-npm.ywwl.com/firstline/download/firstline-1.0.0.tgz","integrity":"sha512-FuZlgVjpIZ5Gj3BxowsTUjO8SmdlBQX7hiNDfH3mzdR+pASxXhr54CogrhUM2oWKYlA4v/lGP1Eas/hCPtssDQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID4JsGpNYkyBtaaT8FUwQfX+tRbmIxxTTzBScaq55TnSAiBrJJ5Zn4Odyx8mRGSGlTfwrpc3z6O8/1AJ8Mnsud/lEg=="}],"size":5273,"noattachment":false,"key":"/firstline/-/firstline-1.0.0.tgz"},"directories":{},"readme":"# Firstline\n\n[![Build status](https://img.shields.io/travis/pensierinmusica/firstline.svg)](https://travis-ci.com/pensierinmusica/firstline)\n[![Test coverage](https://img.shields.io/coveralls/pensierinmusica/firstline.svg)](https://coveralls.io/r/pensierinmusica/firstline)\n[![Dependencies](https://img.shields.io/david/pensierinmusica/firstline.svg)](https://www.npmjs.com/package/firstline)\n[![Npm version](https://img.shields.io/npm/v/firstline.svg)](https://www.npmjs.com/package/firstline)\n[![License](https://img.shields.io/github/license/pensierinmusica/firstline.svg)](https://www.npmjs.com/package/firstline)\n\n## Introduction\n\nFirstline is a [npm](http://npmjs.org) async module for [NodeJS](http://nodejs.org/), that **reads and returns the first line of any file**. It uses native JS promises and streams (requires Node >= v6.4.0). It is well tested and built for high performance.\n\nIt is particularly suited when you need to programmatically access the first line of a large amount of files, while handling errors if they occur.\n\n## Install\n\n`npm install firstline`\n\n## Usage\n\n`firstline(filePath, [opts])`\n\n- filePath (String): the full path to the file you want to read.\n- opts (Object, optional):\n  - encoding (String), set the file encoding (must be [supported by Node.js](https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings)).\n  - lineEnding (String), the character used for line ending (defaults to `\\n`).\n\nIncrementally reads data from `filePath` until it reaches the end of the first line.\n\nReturns a promise, eventually fulfilled with a string.\n\n## Examples\n\n```js\n// Imagine the file content is:\n// abc\n// def\n// ghi\n//\n\nfirstline('./my-file.txt');\n// -> Returns a promise that will be fulfilled with 'abc'.\n\nfirstline('./my-file.txt', { lineEnding: '\\r' });\n// -> Same as above, but using '\\r' as line ending.\n```\n\n***\n\nMIT License","publish_time":1425142689865,"_cnpm_publish_time":1425142689865,"dist-tags":{"latest":"2.0.2"}}