{"name":"byline","description":"simple line-by-line stream reader","homepage":"https://github.com/jahewson/node-byline","bugs":{"url":"https://github.com/jahewson/node-byline/issues"},"version":"4.2.2","author":{"name":"John Hewson"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/jahewson/node-byline.git"},"engines":{"node":">=0.10.0"},"main":"./lib/byline.js","files":["lib"],"devDependencies":{"mocha":"~2.1.0","request":"~2.27.0"},"scripts":{"test":"mocha -R spec --timeout 60000"},"gitHead":"5652e7f669730b1d1b617b054ed4f1efd52cd1df","_id":"byline@4.2.2","_shasum":"c203a98a5b0290822a9386a78eda2cbd5bcdb32f","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.6.0","_npmUser":{"name":"jahewson","email":"john@jahewson.com"},"maintainers":[{"name":"jahewson","email":"johnahewson@yahoo.co.uk"}],"dist":{"shasum":"c203a98a5b0290822a9386a78eda2cbd5bcdb32f","tarball":"http://registry-npm.ywwl.com/byline/download/byline-4.2.2.tgz","integrity":"sha512-6s4GWNZTRUO2sqw75bpdoeZdpyncV8vbbCtEMFnIZf6JCgDVxo0/c6mxObXA0gb6ALrE4srsc2l0Ke9YZg/H8Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCFr/2w6MaosOIg2sVWEdFhVQsqcE8nbDQOnmIiU+wMOgIhAPhRloSWQioVDVDrRfCHD7REqrOX48UZlPmcnZg9JwdX"}],"size":3597,"noattachment":false,"key":"/byline/-/byline-4.2.2.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/byline-4.2.2.tgz_1469083227638_0.3850977721158415"},"directories":{},"readme":"# byline — buffered stream for reading lines\n\n![npm package](https://nodei.co/npm/byline.png?downloads=true&downloadRank=true)\n\n`byline` is a simple module providing a `LineStream`.\n\n- node v0.10 `streams2` (transform stream)\n- supports `pipe`\n- supports both UNIX and Windows line endings\n- supports [Unicode UTS #18 line boundaries](http://www.unicode.org/reports/tr18/#Line_Boundaries)\n- can wrap any readable stream\n- can be used as a readable-writable \"through-stream\" (transform stream)\n- super-simple: `stream = byline(stream);`\n\n## Install\n\n    npm install byline\n\nor from source:\n\n    git clone git://github.com/jahewson/node-byline.git\n    cd node-byline\n    npm link\n\n# Convenience API\n\nThe `byline` module can be used as a function to quickly wrap a readable stream:\n\n```javascript\nvar fs = require('fs'),\n    byline = require('byline');\n\nvar stream = byline(fs.createReadStream('sample.txt', { encoding: 'utf8' }));\n```\n\nThe `data` event then emits lines:\n\n```javascript\nstream.on('data', function(line) {\n  console.log(line);\n});\n```\n\n# Standard API\n    \nYou just need to add one line to wrap your readable `Stream` with a `LineStream`.\n\n```javascript\nvar fs = require('fs'),\t\n    byline = require('byline');\n\nvar stream = fs.createReadStream('sample.txt');\nstream = byline.createStream(stream);\n\nstream.on('data', function(line) {\n  console.log(line);\n});\n```\n\n# Piping\n\n`byline` supports `pipe` (though it strips the line endings, of course).\n\n```javascript\nvar stream = fs.createReadStream('sample.txt');\nstream = byline.createStream(stream);\nstream.pipe(fs.createWriteStream('nolines.txt'));\n```\n\nAlternatively, you can create a readable/writable \"through-stream\" which doesn't wrap any specific\nstream:\n\n```javascript\nvar stream = fs.createReadStream('sample.txt');\nstream = byline.createStream(stream);\nstream.pipe(fs.createWriteStream('nolines.txt'));\n\t\nvar input = fs.createReadStream('LICENSE');\nvar lineStream = byline.createStream();\ninput.pipe(lineStream);\n\nvar output = fs.createWriteStream('test.txt');\nlineStream.pipe(output);\n```\n\n# Streams2 API\n    \nNode v0.10 added a new streams2 API. This allows the stream to be used in non-flowing mode and is\npreferred over the legacy pause() and resume() methods.\n\n```javascript\nvar stream = fs.createReadStream('sample.txt');\nstream = byline.createStream(stream);\n\nstream.on('readable', function() {\n  var line;\n  while (null !== (line = stream.read())) {\n    console.log(line);\n  }\n});\n```\n\n# Transform Stream\n\nThe `byline` transform stream can be directly manipulated like so:\n\n```javascript\nvar LineStream = require('byline').LineStream;\n\nvar input = fs.createReadStream('sample.txt');\nvar output = fs.createWriteStream('nolines.txt');\n\nvar lineStream = new LineStream();\ninput.pipe(lineStream);\nlineStream.pipe(output);\n\n```\n\n# Empty Lines\n\nBy default byline skips empty lines, if you want to keep them, pass the `keepEmptyLines` option in\nthe call to `byline.createStream(stream, options)` or `byline(stream, options)`.\n\n# Tests\n\n    npm test\n\n# v0.8\n\nIf you want to use `node-byline` with node v0.8 then you can use the 2.1.x series. Simply use the\nfollowing in your `package.json`:\n\n```javascript\n  \"dependencies\": {\n  \"byline\": \">=2.1.0 <3.0.0\"\n},\n```\n\n# Simple\nUnlike other modules (of which there are many), `byline` contains no:\n\n- monkeypatching\n- dependencies\n- non-standard 'line' events which break `pipe`\n- limitations to only file streams\n- CoffeeScript\n- unnecessary code\n","publish_time":1469083230352,"_cnpm_publish_time":1469083230352,"dist-tags":{"latest":"5.0.0"}}