diff options
Diffstat (limited to 'node_modules/speedometer')
-rw-r--r-- | node_modules/speedometer/LICENSE | 20 | ||||
-rw-r--r-- | node_modules/speedometer/README.md | 38 | ||||
-rw-r--r-- | node_modules/speedometer/index.js | 35 | ||||
-rw-r--r-- | node_modules/speedometer/package.json | 14 |
4 files changed, 0 insertions, 107 deletions
diff --git a/node_modules/speedometer/LICENSE b/node_modules/speedometer/LICENSE deleted file mode 100644 index 4b30ed5..0000000 --- a/node_modules/speedometer/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright 2013 Mathias Buus - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/speedometer/README.md b/node_modules/speedometer/README.md deleted file mode 100644 index f4e5711..0000000 --- a/node_modules/speedometer/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# speedometer - -Speed measurement in Javascript - -``` -npm install speedometer -``` - -## Usage - -``` js -var speedometer = require('speedometer') -var fs = require('fs') - -// Let's measure how fast we can read from /dev/urandom -var speed = speedometer() -var stream = fs.createReadStream('/dev/urandom') - -stream.on('data', function(data) { - // Simply call speed with the amount of bytes transferred - var bytesPerSecond = speed(data.length) - - console.log(bytesPerSecond+' bytes/second') -}) -``` - -You can always get the current speed by calling `speed()`. - -Per default `speedometer` uses a 5 second buffer. -To change this simply pass another value to the constructor - -``` js -var speed = speedometer(20) // uses a 20s buffer instead -``` - -## License - -MIT diff --git a/node_modules/speedometer/index.js b/node_modules/speedometer/index.js deleted file mode 100644 index 5570fe0..0000000 --- a/node_modules/speedometer/index.js +++ /dev/null @@ -1,35 +0,0 @@ -var tick = 1 -var maxTick = 65535 -var resolution = 4 -var inc = function() { - tick = (tick + 1) & maxTick -} - -var timer = setInterval(inc, (1000 / resolution) | 0) -if (timer.unref) timer.unref() - -module.exports = function(seconds) { - var size = resolution * (seconds || 5) - var buffer = [0] - var pointer = 1 - var last = (tick-1) & maxTick - - return function(delta) { - var dist = (tick - last) & maxTick - if (dist > size) dist = size - last = tick - - while (dist--) { - if (pointer === size) pointer = 0 - buffer[pointer] = buffer[pointer === 0 ? size-1 : pointer-1] - pointer++ - } - - if (delta) buffer[pointer-1] += delta - - var top = buffer[pointer-1] - var btm = buffer.length < size ? 0 : buffer[pointer === size ? 0 : pointer] - - return buffer.length < resolution ? top : (top - btm) * resolution / buffer.length - } -}
\ No newline at end of file diff --git a/node_modules/speedometer/package.json b/node_modules/speedometer/package.json deleted file mode 100644 index d52fc66..0000000 --- a/node_modules/speedometer/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "speedometer", - "version": "0.1.4", - "repository": "git://github.com/mafintosh/speedometer", - "description": "simple speed measurement in javascript", - "keywords": [ - "speed", - "bytes", - "per", - "second", - "transfer" - ], - "author": "Mathias Buus Madsen <mathiasbuus@gmail.com>" -} |