{"name":"n-readlines","version":"0.1.0","description":"Read file line by line without buffering the whole file in memory.","main":"./readlines.js","dependencies":{},"repository":{"type":"git","url":"http://github.com/nacholibre/node-readlines.git"},"keywords":["read","line","readline","readfile","linebyline","readlines"],"engines":{"node":">=0.10.0"},"devDependencies":{"mocha":"^2.0.1"},"author":{"name":"Yoan Arnaudov","email":"jonidev@gmail.com"},"license":"MIT","gitHead":"44c0768cf8c7ed465f8abea8e16a1a708cc40561","bugs":{"url":"https://github.com/nacholibre/node-readlines/issues"},"homepage":"https://github.com/nacholibre/node-readlines","_id":"n-readlines@0.1.0","scripts":{},"_shasum":"ecd7d2997230f1c221641b0c18b0933edb017c67","_from":".","_npmVersion":"2.1.17","_nodeVersion":"0.10.35","_npmUser":{"name":"nacholibre","email":"jonidev@gmail.com"},"maintainers":[{"name":"nacholibre","email":"jonidev@gmail.com"}],"dist":{"shasum":"ecd7d2997230f1c221641b0c18b0933edb017c67","tarball":"http://registry-npm.ywwl.com/n-readlines/download/n-readlines-0.1.0.tgz","integrity":"sha512-yjRZTHsSc+R+ZIatBw/cdQPciqVbZZp2b21nRoX9yFN8/QCmUD/FRmq836y5XGlAsVg7VXqhYysVsrPonX8Kjw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBpRvB22XOGIGGeKZ6chc1bPlBsg/E0T51ouuj+0Lo11AiBXh6UJaUcwnpvfEgZAXp8boLrF0Qx0LPwgM3sjM5Kt5g=="}],"size":2379,"noattachment":false,"key":"/n-readlines/-/n-readlines-0.1.0.tgz"},"directories":{},"readme":"[![Build Status](https://travis-ci.org/nacholibre/node-readlines.svg)](https://travis-ci.org/nacholibre/node-readlines)\n# node-readlines\nReading file line by line may seem like a trivial problem, but in node, there is no straightforward way to do it. There are a lot of libraries using Transform Streams to achieve it, but it seems like a overkill, so I've wrote simple version using only the `filesystem` module of node. Note that this is *synchronous* library.\n\nInstall with\n`npm install n-readlines`\n\n---------------------------------------\n\n## Documentation\n### new readlines(filename, [options]);\n### new readlines(fd, [options]);\n\n**Arguments**\n\n* `filename` - String path to the file you want to read from\n* `fd` - File descriptor\n* `options` - Object\n  * `readChunk` - Integer number of bytes to read at once. Default: 1024\n  * `newLineCharacter` - String new line character, only works with one byte characters for now. Default: `\\n` which is `0x0a` hex encoded\n\n`node-readlines` can handle files without newLineCharacter after the last line\n\n---------------------------------------\n\n### readlines.next()\nReturns `buffer` with the line data without the `newLineCharacter` or `false` if end of file is reached.\n\n---------------------------------------\n### readlines.reset()\nResets the pointer and starts from the beginning of the file. This works only if the end is not reached.\n\n---------------------------------------\n### readlines.close()\nManually close the open file, subsequent `next()` calls will return false. This works only if the end is not reached.\n\n---------------------------------------\n\n## Example\n```javascript\nconst lineByLine = require('n-readlines');\nconst liner = new lineByLine('./test/fixtures/normalFile.txt');\n\nlet line;\nlet lineNumber = 0;\n\nwhile (line = liner.next()) {\n    console.log('Line ' + lineNumber + ': ' + line.toString('ascii'));\n    lineNumber++;\n}\n\nconsole.log('end of line reached');\n```\n","publish_time":1419856128227,"_cnpm_publish_time":1419856128227,"dist-tags":{"latest":"3.4.1"}}