{"_id":"stream-meter","_rev":"15-234a7f1bb9bc373c3cb74d3cd375142f","name":"stream-meter","description":"A stream meter that both counts the bytes piped through it, and can optionally abort on a max size.  (e.g. limit a http request size)","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"stream-meter","version":"1.0.0","description":"A stream meter that both counts the bytes piped through it, and can optionally abort on a max size.  (e.g. limit a http request size)","main":"index.js","directories":{"test":"test"},"dependencies":{"readable-stream":"~1.0.2"},"devDependencies":{"concat-stream":"~1.0.0","stream-spigot":"~1.0.0","tap":"~0.4.3"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"https://github.com/brycebaril/node-stream-meter.git"},"keywords":["streams2","streams","meter","abort"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/node-stream-meter/issues"},"_id":"stream-meter@1.0.0","dist":{"shasum":"7e30e9ed55c13488d49cb0d3e3e8d578cae8f1bd","tarball":"https://registry.npmjs.org/stream-meter/-/stream-meter-1.0.0.tgz","integrity":"sha512-z9yW9VIlIYNuWdjXf71g5SX6HZW8pg2X8vuO1F1jTZTSiGE7KIFd5qy3YJDKikCP8khVKZroH3jCRNZluyo2qQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG9mNov9hzYo3NAVnSCD/tgwpAwcrD3v4vgJVrGyDNAGAiA+8wpzsHL3Jm4BR8YKc8lh5UMYmPCIB99iq9gRvMOhcA=="}]},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":"bryce@ravenwall.com"}]},"1.0.1":{"name":"stream-meter","version":"1.0.1","description":"A stream meter that both counts the bytes piped through it, and can optionally abort on a max size.  (e.g. limit a http request size)","main":"index.js","directories":{"test":"test"},"dependencies":{"readable-stream":"~1.0.2"},"devDependencies":{"concat-stream":"~1.0.0","stream-spigot":"~2.0.0","tap":"~0.4.3"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"https://github.com/brycebaril/node-stream-meter.git"},"keywords":["streams2","streams","meter","abort"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/node-stream-meter/issues"},"_id":"stream-meter@1.0.1","dist":{"shasum":"86115b8ea96eaabf6e12f8b9c4c24112b2dd9f1b","tarball":"https://registry.npmjs.org/stream-meter/-/stream-meter-1.0.1.tgz","integrity":"sha512-cqdw/cf1GrupCXJDqnh9Uj68g7eGbZQdy5sraXKBLSRZUU1WmvmIY/1CECi6XoXK/tz4svHS1NPbgEljE8d9zg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDAdSIZhzMu6oZ1baqC952IKlhSB+sQb2eUXOiha1nVfgIgMYRAJ1p9EySpQ8+AcgSi8Udx4LwAu+QaqVnNjfdjX20="}]},"_from":".","_npmVersion":"1.3.2","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":"bryce@ravenwall.com"}]},"1.0.2":{"name":"stream-meter","version":"1.0.2","description":"A stream meter that both counts the bytes piped through it, and can optionally abort on a max size.  (e.g. limit a http request size)","main":"index.js","directories":{"test":"test"},"dependencies":{"readable-stream":"~1.1.9"},"devDependencies":{"concat-stream":"~1.0.0","stream-spigot":"~2.1.2","tap":"~0.4.3"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"https://github.com/brycebaril/node-stream-meter.git"},"keywords":["streams2","streams","meter","abort"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/node-stream-meter/issues"},"_id":"stream-meter@1.0.2","dist":{"shasum":"6210d30086af66cdf68315d2b06bf047c6766a2d","tarball":"https://registry.npmjs.org/stream-meter/-/stream-meter-1.0.2.tgz","integrity":"sha512-rPRaBbhTFRcr0qfZ9m8LOT70CW3XSJ0V62naiwIp4rlQaHBmP7pcPfMOmwMjE5+rhYh7I8AiLehq03BTg7OvEw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCZhxltDAJAo+AgG5D7qJaikyj142u/4OVqveaj7ovnsgIgEO5Boa6rQqff/vMBYauQFh0nb1eKFsY/jHMsbl6j5PM="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":"bryce@ravenwall.com"}]},"1.0.3":{"name":"stream-meter","version":"1.0.3","description":"A stream meter that both counts the bytes piped through it, and can optionally abort on a max size.  (e.g. limit a http request size)","main":"index.js","directories":{"test":"test"},"dependencies":{"readable-stream":"~1.1.9"},"devDependencies":{"concat-stream":"~1.0.1","stream-spigot":"~2.1.2","tape":"~1.1.1"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"https://github.com/brycebaril/node-stream-meter.git"},"keywords":["streams2","streams","meter","abort"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/node-stream-meter/issues"},"_id":"stream-meter@1.0.3","dist":{"shasum":"52784e7f44d0aa19f5d3edce8a4ed7ba3c17bb5d","tarball":"https://registry.npmjs.org/stream-meter/-/stream-meter-1.0.3.tgz","integrity":"sha512-KW74R5kL+cop9KotYfQb78a33Ed25PCvdr0jV0SXSJm0vocN4MCOvBbe8b+Lxj/+iYiR2xqJKLa76XqgwSAlyg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFEUiPuIyRHEY7kfCljS88kaWq9s6ebV2jEveSZpf3siAiArj6yDBR94WOQ6pLYZbIc2IVUDRTGRcJdZuDD1Q+ZCDg=="}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":"bryce@ravenwall.com"}]},"1.0.4":{"name":"stream-meter","version":"1.0.4","description":"A stream meter that both counts the bytes piped through it, and can optionally abort on a max size.  (e.g. limit a http request size)","main":"index.js","directories":{"test":"test"},"dependencies":{"readable-stream":"^2.1.4"},"devDependencies":{"concat-stream":"^1.5.1","stream-spigot":"^3.0.3","tape":"^4.6.0"},"scripts":{"test":"node test/"},"repository":{"type":"git","url":"git+https://github.com/brycebaril/node-stream-meter.git"},"keywords":["streams2","streams","meter","abort"],"author":{"name":"Bryce B. Baril"},"license":"MIT","bugs":{"url":"https://github.com/brycebaril/node-stream-meter/issues"},"gitHead":"c4ac12861e3097c3d59d2043d94077f2728a837a","homepage":"https://github.com/brycebaril/node-stream-meter#readme","_id":"stream-meter@1.0.4","_shasum":"52af95aa5ea760a2491716704dbff90f73afdd1d","_from":".","_npmVersion":"3.9.3","_nodeVersion":"6.2.2-pre","_npmUser":{"name":"bryce","email":"bryce@ravenwall.com"},"maintainers":[{"name":"bryce","email":"bryce@ravenwall.com"}],"dist":{"shasum":"52af95aa5ea760a2491716704dbff90f73afdd1d","tarball":"https://registry.npmjs.org/stream-meter/-/stream-meter-1.0.4.tgz","integrity":"sha512-4sOEtrbgFotXwnEuzzsQBYEV1elAeFSO8rSGeTwabuX1RRn/kEq9JVH7I0MRBhKVRR0sJkr0M0QCH7yOLf9fhQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC3o9dojjLJOc/sCwSRnvz8rykywd5aOx7KxpFsrvZrJAiBtoUJuMbEZcAo9jHZbtftZZIuqcYLe1CSPOwv5ukLIWQ=="}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/stream-meter-1.0.4.tgz_1468450629582_0.028855931479483843"}}},"readme":"Stream Meter\n============\n\n[![NPM](https://nodei.co/npm/stream-meter.png)](https://nodei.co/npm/stream-meter/)\n\n[![david-dm](https://david-dm.org/brycebaril/node-stream-meter.png)](https://david-dm.org/brycebaril/node-stream-meter/)\n[![david-dm](https://david-dm.org/brycebaril/node-stream-meter/dev-status.png)](https://david-dm.org/brycebaril/node-stream-meter#info=devDependencies/)\n\nStream Meter is a... uh, meter for streams.\n\nIt is a streams2 Transform stream that passes through content, but counts the number of bytes it forwards.\n\nHowever, give it a size in bytes and it will abort as soon as that threshold is passed. This is useful for capping your [hyperquest](http://npm.im/hyperquest) or http/https clients or servers content size.\n\n```\nnpm install stream-meter\n```\n\nExamples:\n\n```javascript\nvar meter = require(\"stream-meter\")\n\n// make an un-capped meter\nvar m = meter()\nprocess.stdin.pipe(m).pipe(process.stdout)\nsetTimeout(function () {\n  // Log how much we saw in a couple seconds.\n  console.log(m.bytes)\n}, 2000)\n\n// this will abort (with an Error) in the frame where 1024 bytes is reached\nprocess.stdin.pipe(meter(1024)).pipe(process.stdout)\n\n// create a 1024 byte-capped meter\nvar m = meter(1024)\nm.on(\"error\", function (e) {\n  // log the error but don't kill the process\n  console.log(e.message)\n})\nprocess.stdin.pipe(m).pipe(process.stdout)\n\n```\n\n```javascript\nvar hyperquest = require(\"hyperquest\")\n\nvar req = hyperquest(\"https://raw.github.com/mranney/node_redis/master/index.js\")\n\nvar meter = require(\"stream-meter\")(1024)\nmeter.on(\"error\", function (e) {\n  console.log(e.message)\n  console.log(\"Read %s bytes\", meter.bytes)\n})\n\n\nreq.pipe(meter).pipe(process.stderr)\n```\n\n```bash\n$ node hypermeter.js 2> /dev/null\nStream exceeded specified max of 1024 bytes.\nRead 7377 bytes\n```\n\nUsage\n=====\n\n```javascript\nvar meter = require(\"stream-meter\")\n\nvar stream = meter(size)\nstream.on(\"error\", function (e) {\n  // handle the meter aborting the stream\n})\n\n// read the bytes processed by the meter and passed through to any subsequent streams.\nvar size = stream.bytes\n```\n\nSee test/index.js for additional examples.\n\nOptions\n=======\n\nsize\n----\n\nSize (in bytes) to trigger the stream to abort. It will complete whatever frame it aborted in, so the size streamed will still be >= size but no more than size + highWaterMark\n\nProperties\n==========\n\nbytes\n-----\n\nNumber of bytes handled and passed through the meter.\n\nLICENSE\n=======\n\nMIT\n","maintainers":[{"name":"bryce","email":"bryce@ravenwall.com"}],"time":{"modified":"2022-06-27T00:48:19.118Z","created":"2013-07-04T01:55:17.432Z","1.0.0":"2013-07-04T01:55:19.727Z","1.0.1":"2013-07-21T19:57:10.392Z","1.0.2":"2013-09-23T03:17:16.611Z","1.0.3":"2013-09-25T23:32:42.752Z","1.0.4":"2016-07-13T22:57:12.967Z"},"author":{"name":"Bryce B. Baril"},"repository":{"type":"git","url":"git+https://github.com/brycebaril/node-stream-meter.git"},"users":{"bret":true,"kennyjoseph":true,"uxabdullah":true},"homepage":"https://github.com/brycebaril/node-stream-meter#readme","keywords":["streams2","streams","meter","abort"],"bugs":{"url":"https://github.com/brycebaril/node-stream-meter/issues"},"license":"MIT","readmeFilename":"README.md"}