{"name":"byline","description":"insanely simple line-by-line Stream reader","homepage":"https://github.com/jahewson/node-byline","bugs":{"url":"https://github.com/jahewson/node-byline/issues"},"version":"1.0.0","author":{"name":"John Hewson"},"repository":{"type":"git","url":"git://github.com/jahewson/node-byline.git"},"engine":["node >=0.4.0"],"main":"./lib","dependencies":{},"devDependencies":{},"_id":"byline@1.0.0","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"02967a21ba5a8d24922c1d2b35ac5acc60b3612b","tarball":"http://registry-npm.ywwl.com/byline/download/byline-1.0.0.tgz","integrity":"sha512-Z/iB41AyqpqzHGWb/wsadbFh/3asYD2GkAEcyoQTC1AE1I8l68H8kzwvCPM2hSPI0X+NFiA37EokD7OimW97aw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD3Nevjgqq3Z6Be8NHEQDdcmm38iEitFnqKgM6KybRXDgIhAN+8Rqo43jUIfFjyv9CpKX9Rc9v4jGhUK3FlgO70eKlz"}],"size":2134,"noattachment":false,"key":"/byline/-/byline-1.0.0.tgz"},"scripts":{},"maintainers":[{"name":"jahewson","email":"johnahewson@yahoo.co.uk"}],"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":1314831376112,"_cnpm_publish_time":1314831376112,"dist-tags":{"latest":"5.0.0"}}