{"name":"n-readlines","version":"1.0.0","description":"Read file line by line without buffering the whole file in memory.","main":"./readlines.js","dependencies":{},"repository":{"type":"git","url":"git+ssh://git@github.com/nacholibre/node-readlines.git"},"keywords":["read","line","reader","linereader","readfile","linebyline","synchronous","sync","readline","readlines"],"engines":{"node":">=6.x.x"},"devDependencies":{"tape":"^4.9.0"},"scripts":{"test":"tape test/*.test.js"},"author":{"name":"Yoan Arnaudov","email":"jonidev@gmail.com"},"license":"MIT","gitHead":"eb18961ae2555e53a1bd1ab6a84d0f152c4a332e","bugs":{"url":"https://github.com/nacholibre/node-readlines/issues"},"homepage":"https://github.com/nacholibre/node-readlines#readme","_id":"n-readlines@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.9.0","_npmUser":{"name":"nacholibre","email":"jonidev@gmail.com"},"dist":{"integrity":"sha512-ISDqGcspVu6U3VKqtJZG1uR55SmNNF9uK0EMq1IvNVVZOui6MW6VR0+pIZhqz85ORAGp+4zW+5fJ/SE7bwEibA==","shasum":"c353797f216c253fdfef7e91da4e8b17c29a91a6","tarball":"http://registry-npm.ywwl.com/n-readlines/download/n-readlines-1.0.0.tgz","fileCount":15,"unpackedSize":97723,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa9fYECRA9TVsSAnZWagAAz50P/RGCLXDqpFDsmYjSmbFA\npXgjK/FFwSiQX9WaaUBX0wh7JP3QGoTafkzg6QYnSAd8L78OKHdKjAVPtjrB\ncJ0k+ddX//AyLAbZltduEoUfp1p4LlXuvW5HDu3sME/Ka2S+Ed7eLqarnleT\ntsvPWr3b2Ob/mtXlpmm1ooCCQNB1bAB2EMMpNEn1chx74+TpOK7jrx1SkAXE\nrfbn5DVhj0XI7e+e2X5Fa3r2It+n40gv32rvyz5w7/ZSTHPBKsi3UnrhI+3G\n/rshwr4vlyUGq6HI/NvsiL++3Y5wOEo3R4N+jtd5LPeD3xcBGqc2bEhaYKuF\nq7l6f0LPj+xbxhDifoYzhsU2vwXcgRZ1ystwnvoHGRe8EypRW6lHyooTyqCh\nKvlqEqzWZfucdYcJKgg/yLsB+u6eaNi38MTvFK1gTANTPGC8L+EVEF20O2Qk\nNy1k7Smbm7qW4COxQqpv0o5amMgREU2oJ2PGLw523tT8vCZS+ogrBbMTVJwQ\nVugbeRfydEhqeoX8yJ2CfGubTFVbhhSgMg4IhqXiVnApwX4zqJWQnvkO52gP\nPzfIW2zLNBGsNUJnKnBbY/cYe9fqItRbzpa+xNGg5rrv6OqXAubgOM7Uw+E8\nCYPTOUT7vG6zoYxXJo+Z60T045WvONIukhkjJYVVBhFcY9ay6/fi8bYL3sq/\ny3yc\r\n=oTaA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCjZL0+F6+RrqtC1LkCBE34daxV3oQrISzf/ZBT7hM0BAIgLEuuqkm1hbvpLve7pIQ7bQ1FYIQQSmHIM9kYsfV3/2A="}],"size":29498,"noattachment":false,"key":"/n-readlines/-/n-readlines-1.0.0.tgz"},"maintainers":[{"name":"nacholibre","email":"jonidev@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/n-readlines_1.0.0_1526068739627_0.18295114735373508"},"_hasShrinkwrap":false,"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":1526068739740,"_cnpm_publish_time":1526068739740,"dist-tags":{"latest":"3.4.1"}}