stream-progressbar
Advanced tools
Comparing version 1.2.0 to 1.3.0
11
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) { | ||
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); | ||
@@ -33,2 +33,1 @@ }); | ||
}; | ||
{ | ||
"name": "stream-progressbar", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Simple progress bar for node stream", | ||
"main": "index.js", | ||
"files": [ | ||
"index.js" | ||
], | ||
"scripts": { | ||
@@ -7,0 +10,0 @@ "test": "node test/request.js && node test/fs.js && node test/object.js" |
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
3204
4