{"name":"n-readlines","version":"1.0.3","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":"3da9b57e439916801d4715d0b5150e7871deef78","bugs":{"url":"https://github.com/nacholibre/node-readlines/issues"},"homepage":"https://github.com/nacholibre/node-readlines#readme","_id":"n-readlines@1.0.3","_nodeVersion":"14.4.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-kdrBSkcwgcTWI+e9Ag4Vke5pGoOJm/8hnAn7vHC8nHXyyiUgZht+J9EmGhlAWIFZuDvOq0F2SpCPCR/LBkq7OA==","shasum":"f1fc62c31fc214de7fe8bd3f168e3910c25ff3ec","tarball":"http://registry-npm.ywwl.com/n-readlines/download/n-readlines-1.0.3.tgz","fileCount":16,"unpackedSize":98316,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfq/JLCRA9TVsSAnZWagAAccAP/jJP94Xj0tCKDpsUWEIo\nWK548ouUnA5CiDgPN3+e401C9B79zOpmup9Bd+p2uQjQjDi0c03VNIFEpeFU\nAEL2A0x1OSAti1fiPfw0me7hfVqCV+mFXR3gPnl/VDwzkYqnakv3DAxp3jrT\nHC5ru7QjUQmz3n8BIJeJQqVKnxBX0YdbAcxPq/f2lIa7LB6yD217VjT2lv3L\niuEIvcJiD+xE/ldU4qHpEOvvY737HKTV8KBP6VNwOFppz6Hz9q6Yae+88/my\nziQGmseUxJ3Wfd7w9Rw7+ppT7SPtXeS6tjLd/rGGFJfe/DjILcZcmN+WLMKq\nf2seex1FYN5MIMBkaMfYTqwPGNjbpfA3mbhqxX1XMtVv21ULzVvSZA6eCmQL\nlXSu2urY8y9sqkp+LZjAnm05hecCFRt3NXV7m1qP3DYvXGJEf6GxVUsWwjc8\nPs+hD1nFwiltPjVVRb/Kpk0YRgL2G0HoPldXWQBcn1tOT2d3p1eu3Wwm1WWW\np3lLdNCHqRY5YOBQ9vJaAk6SpQBjiU0c6AdXPea49suMidunqAXFrH4O8ct3\nxdG1BJALP1MwgSzhqzXKO5na6eFqUvwcB2IIaedWBlmnlzzhODzl+hpkIs0q\n4jZqFgS5RzjpwCbNe/NJOMAGYtxVzHi58OE9MgVLDC8Pzy+mljDOtpLbJlTE\nwMPe\r\n=/lK1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEVdSg74RCwGN470n1GdKlt2QcJnBnSkzBzA92NBK57wIgZWIjuS/0JGTCiGJbKsy2PrEXq3z+hgE/MndDOZPo+9U="}],"size":29671,"noattachment":false,"key":"/n-readlines/-/n-readlines-1.0.3.tgz"},"_npmUser":{"name":"nacholibre","email":"jonidev@gmail.com"},"directories":{},"maintainers":[{"name":"nacholibre","email":"jonidev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/n-readlines_1.0.3_1605104203268_0.31538170613806527"},"_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":1605104203444,"_cnpm_publish_time":1605104203444,"dist-tags":{"latest":"3.4.1"}}