angular-evaporate
Advanced tools
Comparing version 2.1.2 to 2.2.0
@@ -103,2 +103,4 @@ ;(function () { | ||
* @property {Number} $seconds - estimated elapsed time | ||
* @property {Number} $speed - upload speed | ||
* @property {String} $speedStr - upload speed in human readable format | ||
*/ | ||
@@ -151,2 +153,5 @@ var AngularEvaporateUpload = function (ae, config) { | ||
); | ||
that.$speed = (that.$percent * that.file.size * 10) / | ||
(now - that.$started); | ||
that.$speedStr = ae.$speedStr(that.$speed); | ||
} | ||
@@ -235,2 +240,16 @@ } | ||
}; | ||
/** | ||
* Default upload upload speed function. | ||
* @params {size in bytes} | ||
* @returns {String} - speed of the upload in human readable format | ||
*/ | ||
AngularEvaporate.prototype.$speedStr = function (size) { | ||
var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; | ||
var i = 0; | ||
while(size >= 1024) { | ||
size /= 1024; | ||
++i; | ||
} | ||
return size.toFixed(2).replace('.00', '') + ' ' + units[i] + '/s'; | ||
}; | ||
@@ -237,0 +256,0 @@ // api |
{ | ||
"version": "2.1.2", | ||
"version": "2.2.0", | ||
"name": "angular-evaporate", | ||
@@ -4,0 +4,0 @@ "description": "AngularJS module for the EvaporateJS library", |
@@ -11,3 +11,3 @@ ## angular-evaporate | ||
+ calculates name, url, content type for a new upload, | ||
+ calculates progress percent and estimated time, | ||
+ calculates progress percent, speed and estimated time, | ||
+ saves status updates with timestamps, | ||
@@ -160,2 +160,4 @@ + saves info, warning and error messages, | ||
| `$seconds` | `Number` | optional | estimated elapsed time | ||
| `$speed` | `Number` | optional | upload speed | ||
| `$speedStr` | `String` | optional | upload speed in human readable format | ||
@@ -162,0 +164,0 @@ ### API |
Sorry, the diff of this file is not supported yet
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
52504
20
821
168
1