stream-progressbar
Advanced tools
Comparing version 1.0.1 to 1.0.2
12
index.js
var PassThrough = require('stream').PassThrough; | ||
var ProgressBar = require('progress'); | ||
module.exports = function(tokens, options) { | ||
module.exports = function (tokens, options) { | ||
options = options || {}; | ||
@@ -10,10 +10,10 @@ | ||
pt.on('pipe', function(stream) { | ||
if(total) { | ||
pt.on('pipe', function (stream) { | ||
if (total) { | ||
var bar = new ProgressBar(tokens, options); | ||
pt.on('data', function(chunk) { | ||
pt.on('data', function (chunk) { | ||
bar.tick(chunk.length); | ||
}); | ||
} else { | ||
stream.on('response', function(res) { | ||
stream.on('response', function (res) { | ||
var total = parseInt(res.headers['content-length'], 10); | ||
@@ -23,3 +23,3 @@ options.total = total; | ||
pt.on('data', function(chunk) { | ||
pt.on('data', function (chunk) { | ||
bar.tick(chunk.length); | ||
@@ -26,0 +26,0 @@ }); |
{ | ||
"name": "stream-progressbar", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Simple progress bar for node stream", | ||
@@ -9,12 +9,4 @@ "main": "index.js", | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/esportsguy/stream-progressbar.git" | ||
}, | ||
"author": "Wang Zuo", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/esportsguy/stream-progressbar/issues" | ||
}, | ||
"homepage": "https://github.com/esportsguy/stream-progressbar#readme", | ||
"dependencies": { | ||
@@ -31,3 +23,14 @@ "progress": "^1.1.8" | ||
"pipe" | ||
] | ||
], | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/wangzuo/stream-progressbar.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/wangzuo/stream-progressbar/issues" | ||
}, | ||
"homepage": "https://github.com/wangzuo/stream-progressbar#readme" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
3011
6
25