{"_id":"line-input-stream","_rev":"2786642","name":"line-input-stream","description":"Convert a Node.JS Readable Stream into a Line Buffered Input Stream","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"bluesmoon","email":""}],"time":{"modified":"2022-06-22T03:05:15.000Z","created":"2012-09-04T19:02:21.976Z","1.0.1":"2012-09-04T20:54:20.708Z","1.0.0":"2012-09-04T19:02:21.976Z"},"users":{},"author":{"name":"Philip Tellis","email":"philip@bluesmoon.info","url":"http://bluesmoon.info/"},"repository":{"type":"git","url":"git://github.com/bluesmoon/node-line-input-stream.git"},"versions":{"1.0.1":{"name":"line-input-stream","version":"1.0.1","description":"Convert a Node.JS Readable Stream into a Line Buffered Input Stream","keywords":["stream","input","line","line-buffered","readable stream"],"homepage":"https://github.com/bluesmoon/node-line-input-stream","author":{"name":"Philip Tellis","email":"philip@bluesmoon.info","url":"http://bluesmoon.info/"},"files":["lib/"],"main":"lib/line-input-stream.js","repository":{"type":"git","url":"git://github.com/bluesmoon/node-line-input-stream.git"},"engines":{"node":">=0.8.8"},"_id":"line-input-stream@1.0.1","dist":{"shasum":"c1cb779fecae9f2455cc435c0103632bade04c26","size":2282,"noattachment":false,"key":"/line-input-stream/-/line-input-stream-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/line-input-stream/download/line-input-stream-1.0.1.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"bluesmoon","email":"philip@bluesmoon.info"},"maintainers":[{"name":"bluesmoon","email":""}],"directories":{},"publish_time":1346792060708,"_hasShrinkwrap":false,"_cnpm_publish_time":1346792060708,"_cnpmcore_publish_time":"2021-12-16T23:54:30.233Z"},"1.0.0":{"name":"line-input-stream","version":"1.0.0","description":"Convert a Node.JS Readable Stream into a Line Buffered Input Stream","keywords":["stream","input","line","line-buffered","readable stream"],"homepage":"https://github.com/bluesmoon/node-line-input-stream","author":{"name":"Philip Tellis","email":"philip@bluesmoon.info","url":"http://bluesmoon.info/"},"files":["lib/"],"main":"lib/line-input-stream.js","repository":{"type":"git","url":"git://github.com/bluesmoon/node-line-input-stream.git"},"engines":{"node":">=0.8.8"},"_id":"line-input-stream@1.0.0","dist":{"shasum":"38b3c42bd4aefd32b8bd9f031999eb7a07bcb0e6","size":2250,"noattachment":false,"key":"/line-input-stream/-/line-input-stream-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/line-input-stream/download/line-input-stream-1.0.0.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"bluesmoon","email":"philip@bluesmoon.info"},"maintainers":[{"name":"bluesmoon","email":""}],"directories":{},"publish_time":1346785341976,"_hasShrinkwrap":false,"_cnpm_publish_time":1346785341976,"_cnpmcore_publish_time":"2021-12-16T23:54:30.437Z"}},"readme":"node-line-input-stream\n======================\n\nConvert a Node.JS Readable Stream into a Line Buffered Input Stream\n\nInstall\n---\n\n```\nnpm install line-input-stream\n```\n\nUsage\n---\n\nLike [Readable Stream](http://nodejs.org/api/stream.html#stream_readable_stream) with a `line` event.\n\n```javascript\nvar LineInputStream = require('line-input-stream'),\n    fs = require('fs');\n\nvar stream = LineInputStream(fs.createReadStream(\"foo.txt\", { flags: \"r\" }));\nstream.setEncoding(\"utf8\");\nstream.setDelimiter(\"\\n\");\t// optional string, defaults to \"\\n\"\n\nstream.on(\"error\", function(err) {\n\t\tconsole.log(err);\n\t});\n\nstream.on(\"data\", function(chunk) {\n\t\t// You don't need to use this event\n\t});\n\nstream.on(\"line\", function(line) {\n\t\t// Sends you lines from the stream delimited by delimiter\n\t});\n\nstream.on(\"end\", function() {\n\t\t// No more data, all line events emitted before this event\n\t});\n\nstream.on(\"close\", function() {\n\t\t// Same as ReadableStream's close event\n\t});\n\nif(stream.readable) {\n\tconsole.log(\"stream is readable\");\n}\n\n// Also available: pause(), resume(), destroy(), pipe()\n```\n\nYou can also attach listeners to any event specific to the underlying stream, ie,\nyou can listen to the `open` event for streams created by [`fs.createReadStream()`](http://nodejs.org/api/fs.html#fs_fs_createreadstream_path_options)\nor the `connect` event for [Net](http://nodejs.org/api/net.html) streams.\n\nA side effect of this is that you can add a listener for any junk string and `LineInputStream` will\npretend that it worked.  The event listener may never be called though.\n\nCaveats & Notes\n---\n- Calling `pause()` might not stop `line` events from firing immediately.  It will stop reading of data\n  from the underlying stream, but any data that has already been read will still be split into lines and\n  a `line` event will be fired for each of them.\n- The delimiter is not included in the line passed to the `line` handler\n- Even though this is called `line-input-stream`, you can delimit by anything, so for example,\n  setting delimiter to `\"\\n\\n\"` will read by paragraph (sort of).\n- You can set the delimiter to a regular expression, which let's you do cool things like drop multiple blank lines: `/[\\r\\n]+/`\n\n\nCopyright\n---\nPhilip Tellis [@bluesmoon](https://twitter.com/bluesmoon) <philip@lognormal.com> \n\nLicense\n---\n(Apache License)[LICENSE.md]\n","_attachments":{},"homepage":"https://github.com/bluesmoon/node-line-input-stream"}