{"name":"n-readlines","version":"1.0.1","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":"74d948142d76610a6aafb543b0fb1bc9d2d42ba9","bugs":{"url":"https://github.com/nacholibre/node-readlines/issues"},"homepage":"https://github.com/nacholibre/node-readlines#readme","_id":"n-readlines@1.0.1","_nodeVersion":"14.4.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-z4SyAIVgMy7CkgsoNw7YVz40v0g4+WWvvqy8+ZdHrCtgevcEO758WQyrYcw3XPxcLxF+//RszTz/rO48nzD0wQ==","shasum":"bbb7364d38bc31a170a199f986fcacfa76b95f6e","tarball":"http://registry-npm.ywwl.com/n-readlines/download/n-readlines-1.0.1.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/MrCRA9TVsSAnZWagAAFIcP/i4tNRl0c6RHo4C5PJIQ\nrhgp8/1AWmHZWz5XzojaPnHInsqi3XO/Xo59qFd75q0vRnWsw1I9ft1vRJrc\nGGz15rJEx2bBy5ofl8czBDmlc/UEBgtHgCTXi9bhlg7PG0kqMpKiUeECzZsk\nG1pWLeqepiBBBKY9Ga3shWe/S4gpi9P/cQPFXZbkUHl6X/YLFRoq3eF8jPWg\nRei0W54sTUsXPrBRwCKxP7ld5FHpKaFmNSDKUSyTjAY9L5E0se7hd8EQtDhd\nZneGRweGayPvN8n1I93erimJGHwONphD4JYh2s8h1VAChDlOOGl9otGGG/mk\nRDUvC/BAas9aSibiSbybMSnPkWMeatIwa7S9XlTs5RsDGQ1ToPSbqOw6PUDs\nL0ZFqvbvxGX2Ecn3UCseaqPbkDNJWo8SfQ88k0vFvurGKu1rMuYijCEVH/F4\nh6oQ8SQWazupVZwZZDHM91DCxlq+D0kuKbenN85FWQmBnNr6H1NpXRAUzhDN\nNmCGyzZdhtVz3UWbWfqUJQ2xTazmYnOdTIf/dwjvg8teYKopNEzHXjUpN87J\nI97EYIx4oABFUJ/VgXEnEzIhsOVCgHZVpOg2HNRIxotVrMuygYa3HKYi5m4I\nUIw5wBwH+4k89b1dNUhnnJnkGN4D/rop752fSPpATJNAjyj4YG2i9mNs8LPK\nhdsG\r\n=tKM9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIALkp5OaiZnbaE4eCgvX5WbSFC032g3ci8eOx6moS2NfAiAnRyjmQdw6M3zdnM+eXWF/XdPsIuSM2ob5mJ1/3I8I6g=="}],"size":29671,"noattachment":false,"key":"/n-readlines/-/n-readlines-1.0.1.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.1_1605104426979_0.11790571890431867"},"_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":1605104427124,"_cnpm_publish_time":1605104427124,"dist-tags":{"latest":"3.4.1"}}