{"_id":"line-readable-stream","_rev":"3014176","name":"line-readable-stream","description":"Provides a stream wrapper for a node.js Readable Stream for line-by-line reading","dist-tags":{"latest":"1.1.4"},"maintainers":[{"name":"nikeee","email":""}],"time":{"modified":"2023-09-20T06:32:37.000Z","created":"2014-05-14T11:28:29.724Z","1.1.4":"2014-09-06T19:41:45.983Z","1.0.4":"2014-05-14T16:47:35.803Z","1.0.3":"2014-05-14T16:24:09.428Z","1.0.2":"2014-05-14T16:12:30.625Z","1.0.1":"2014-05-14T11:28:29.724Z"},"users":{},"author":{"name":"nikeee","email":"holzig@outlook.com","url":"https://github.com/nikeee"},"repository":{"type":"git","url":"git://github.com/nikeee/node-line-readable-stream.git"},"versions":{"1.1.4":{"author":{"name":"nikeee","email":"holzig@outlook.com","url":"https://github.com/nikeee"},"name":"line-readable-stream","description":"Provides a stream wrapper for a node.js Readable Stream for line-by-line reading","version":"1.1.4","repository":{"type":"git","url":"git://github.com/nikeee/node-line-readable-stream.git"},"main":"line-readable-stream.js","dependencies":{},"keywords":["stream","input","line","line-buffered","readable stream","typescript"],"optionalDependencies":{},"engines":{"node":"*"},"bugs":{"url":"https://github.com/nikeee/node-line-readable-stream/issues","email":"holzig@outlook.com"},"license":"Beerware","gitHead":"cd2ede41bef26be942c039a1b09d55ada587e72e","homepage":"https://github.com/nikeee/node-line-readable-stream","_id":"line-readable-stream@1.1.4","scripts":{},"_shasum":"b35484c26cdd2b52ce92e868795c1af0f3784960","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"nikeee","email":"holzig@outlook.com"},"maintainers":[{"name":"nikeee","email":""}],"dist":{"shasum":"b35484c26cdd2b52ce92e868795c1af0f3784960","size":16074,"noattachment":false,"key":"/line-readable-stream/-/line-readable-stream-1.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/line-readable-stream/download/line-readable-stream-1.1.4.tgz"},"deprecated":"Use byline instead","directories":{},"_cnpmcore_publish_time":"2021-12-21T13:24:48.124Z","publish_time":1410032505983,"_cnpm_publish_time":1410032505983},"1.0.4":{"author":{"name":"nikeee","email":"holzig@outlook.com","url":"https://github.com/nikeee"},"name":"line-readable-stream","description":"Provides a stream wrapper for a node.js Readable Stream for line-by-line reading","version":"1.0.4","repository":{"type":"git","url":"git://github.com/nikeee/node-line-readable-stream.git"},"main":"LineReadableStream.js","dependencies":{},"keywords":["stream","input","line","line-buffered","readable stream","typescript"],"optionalDependencies":{},"engines":{"node":"*"},"bugs":{"url":"https://github.com/nikeee/node-line-readable-stream/issues","email":"holzig@outlook.com"},"license":"Beerware","homepage":"https://github.com/nikeee/node-line-readable-stream","_id":"line-readable-stream@1.0.4","_shasum":"8aabec0a67d6dcaf99535725064212f86ddb32a5","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"nikeee","email":"holzig@outlook.com"},"maintainers":[{"name":"nikeee","email":""}],"dist":{"shasum":"8aabec0a67d6dcaf99535725064212f86ddb32a5","size":15838,"noattachment":false,"key":"/line-readable-stream/-/line-readable-stream-1.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/line-readable-stream/download/line-readable-stream-1.0.4.tgz"},"deprecated":"Use byline instead","directories":{},"_cnpmcore_publish_time":"2021-12-21T13:24:47.233Z","publish_time":1400086055803,"_cnpm_publish_time":1400086055803},"1.0.3":{"author":{"name":"nikeee","email":"holzig@outlook.com","url":"https://github.com/nikeee"},"name":"line-readable-stream","description":"Provides a stream wrapper for a node.js Readable Stream for line-by-line reading","version":"1.0.3","repository":{"type":"git","url":"git://github.com/nikeee/node-line-readable-stream.git"},"main":"LineReadableStream.js","dependencies":{},"keywords":["stream","input","line","line-buffered","readable stream","typescript"],"optionalDependencies":{},"engines":{"node":"*"},"bugs":{"url":"https://github.com/nikeee/node-line-readable-stream/issues","email":"holzig@outlook.com"},"license":"Beerware","homepage":"https://github.com/nikeee/node-line-readable-stream","_id":"line-readable-stream@1.0.3","_shasum":"7fa2dd65447fbf03a6b6de2e8890bcdfe6c3b9df","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"nikeee","email":"holzig@outlook.com"},"maintainers":[{"name":"nikeee","email":""}],"dist":{"shasum":"7fa2dd65447fbf03a6b6de2e8890bcdfe6c3b9df","size":12946,"noattachment":false,"key":"/line-readable-stream/-/line-readable-stream-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/line-readable-stream/download/line-readable-stream-1.0.3.tgz"},"deprecated":"Use byline instead","directories":{},"_cnpmcore_publish_time":"2021-12-21T13:24:46.364Z","publish_time":1400084649428,"_cnpm_publish_time":1400084649428},"1.0.2":{"author":{"name":"nikeee","email":"holzig@outlook.com","url":"https://github.com/nikeee"},"name":"line-readable-stream","description":"Provides a stream wrapper for a node.js Readable Stream for line-by-line reading","version":"1.0.2","repository":{"type":"git","url":"git://github.com/nikeee/node-line-readable-stream.git"},"main":"LineReadableStream.js","dependencies":{},"keywords":["stream","input","line","line-buffered","readable stream","typescript"],"optionalDependencies":{},"engines":{"node":"*"},"bugs":{"url":"https://github.com/nikeee/node-line-readable-stream/issues","email":"holzig@outlook.com"},"license":"Beerware","homepage":"https://github.com/nikeee/node-line-readable-stream","_id":"line-readable-stream@1.0.2","_shasum":"31694a9f6c71972c2342a53839a36d18633f9a59","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"nikeee","email":"holzig@outlook.com"},"maintainers":[{"name":"nikeee","email":""}],"dist":{"shasum":"31694a9f6c71972c2342a53839a36d18633f9a59","size":12936,"noattachment":false,"key":"/line-readable-stream/-/line-readable-stream-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/line-readable-stream/download/line-readable-stream-1.0.2.tgz"},"deprecated":"Use byline instead","directories":{},"_cnpmcore_publish_time":"2021-12-21T13:24:45.489Z","publish_time":1400083950625,"_cnpm_publish_time":1400083950625},"1.0.1":{"author":{"name":"nikeee","email":"holzig@outlook.com","url":"https://github.com/nikeee"},"name":"line-readable-stream","description":"Provides a stream wrapper for a node.js Readable Stream for line-by-line reading","version":"1.0.1","repository":{"type":"git","url":"git://github.com/nikeee/node-line-readable-stream.git"},"main":"LineReadableStream.js","dependencies":{},"keywords":["stream","input","line","line-buffered","readable stream","typescript"],"optionalDependencies":{},"engines":{"node":"*"},"bugs":{"url":"https://github.com/nikeee/node-line-readable-stream/issues","email":"holzig@outlook.com"},"license":"Beerware","homepage":"https://github.com/nikeee/node-line-readable-stream","_id":"line-readable-stream@1.0.1","_shasum":"f51d599860429462731db3679bf1c9916b3a21cd","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"nikeee","email":"holzig@outlook.com"},"maintainers":[{"name":"nikeee","email":""}],"dist":{"shasum":"f51d599860429462731db3679bf1c9916b3a21cd","size":13185,"noattachment":false,"key":"/line-readable-stream/-/line-readable-stream-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/line-readable-stream/download/line-readable-stream-1.0.1.tgz"},"deprecated":"Use byline instead","directories":{},"_cnpmcore_publish_time":"2021-12-21T13:24:44.633Z","publish_time":1400066909724,"_cnpm_publish_time":1400066909724}},"readme":"node-line-readable-stream\r\n==============\r\n\r\n\r\nThis is a port of [bluesmoon's node-line.input-stream](https://github.com/bluesmoon/node-line-input-stream). Provides a stream wrapper for a node.js Readable Stream for line-by-line reading.\r\n\r\nHow to install\r\n---------------\r\n\r\nNode:\r\n\r\n\tnpm install line-readable-stream\r\n\t\r\nExample Usage\r\n----------------\r\n\r\nLike [Readable Stream](http://nodejs.org/api/stream.html#stream_readable_stream) with a <code>line</code> event.\r\n\r\nJavaScript:\r\n```JavaScript\r\nvar LineReadableStream = require('line-readable-stream');\r\nvar fs = require('fs');\r\n\r\nvar stream = new LineReadableStream(fs.createReadStream(\"foo.txt\", { flags: \"r\" }));\r\nstream.setEncoding(\"utf8\");\r\nstream.setDelimiter(\"\\n\");  // optional string, defaults to \"\\n\"\r\n\r\nstream.on(\"error\", function(err) {\r\n\t\tconsole.log(err);\r\n\t});\r\n\r\nstream.on(\"data\", function(chunk) {\r\n\t\t// You don't need to use this event\r\n\t});\r\n\r\nstream.on(\"line\", function(line) {\r\n\t\t// Sends you lines from the stream delimited by delimiter\r\n\t});\r\n\r\nstream.on(\"end\", function() {\r\n\t\t// No more data, all line events emitted before this event\r\n\t});\r\n\r\nstream.on(\"close\", function() {\r\n\t\t// Same as ReadableStream's close event\r\n\t});\r\n\r\nif(stream.readable) {\r\n\tconsole.log(\"stream is readable\");\r\n}\r\n\r\n// Also available: resume(), pipe()\r\n```\r\n\r\nTypeScript:\r\n\r\n```TypeScript\r\n///<require path=\"typings/node/node.d.ts\"/>\r\n///<require path=\"node_modules/line-readable-stream/LineReadableStream.d.ts\"/>\r\n\r\n// If you know a better war to include the .ts file that comes with the npm package, let me know.\r\nimport LineReadableStream = require('node_modules/line-readable-stream/LineReadableStream');\r\nimport fs = require('fs');\r\n\r\nvar stream = new LineReadableStream(fs.createReadStream(\"foo.txt\", { flags: \"r\" }));\r\nstream.setEncoding(\"utf8\");\r\nstream.setDelimiter(\"\\n\");  // optional string, defaults to \"\\n\"\r\n\r\nstream.on(\"error\", err => console.log(err));\r\n\r\nstream.on(\"data\", chunk => {\r\n\t\t// You don't need to use this event\r\n\t});\r\n\r\nstream.on(\"line\", line => {\r\n\t\t// Sends you lines from the stream delimited by delimiter\r\n\t\tconsole.log(\"Line: \" + line);\r\n\t});\r\n\r\nstream.on(\"end\", () => {\r\n\t\t// No more data, all line events emitted before this event\r\n\t});\r\n\r\nstream.on(\"close\", () => {\r\n\t\t// Same as ReadableStream's close event\r\n\t});\r\n\r\nif(stream.readable)\r\n\tconsole.log(\"stream is readable\");\r\n\r\n\r\n// Also available: resume(), pipe()\r\n```\r\n\r\nUsage information\r\n-----------------\r\n\r\n\r\nYou can also attach listeners to any event specific to the underlying stream, ie,\r\nyou can listen to the <code>open</code> event for streams created by [<code>fs.createReadStream()</code>](http://nodejs.org/api/fs.html#fs_fs_createreadstream_path_options)\r\nor the <code>connect</code> event for [Net](http://nodejs.org/api/net.html) streams.\r\n\r\nA side effect of this is that you can add a listener for any junk string and <code>LineReadableStream</code> will\r\npretend that it worked.  The event listener may never be called though.\r\n\r\n\r\n- The delimiter is not included in the line passed to the <code>line</code> handler\r\n- Even though this is called <code>line-readable-stream</code>, you can delimit by any string, so for example, setting delimiter to `\"\\n\\n\"` will read by paragraph (sort of).\r\n- You can set the delimiter to a regular expression, which let's you do cool things like drop multiple blank lines: <code>/[\\r\\n]+/</code>\r\n- All methods return `this`, so can be chained\r\n","_attachments":{},"homepage":"https://github.com/nikeee/node-line-readable-stream","bugs":{"url":"https://github.com/nikeee/node-line-readable-stream/issues","email":"holzig@outlook.com"},"license":"Beerware"}