@vbarbarosh/node-helpers 3.19.0 → 3.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/fastdl.js +3 -2
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Vladimir Barbarosh <vladimir.barbarosh@gmail.com>",
3
3
  "license": "MIT",
4
4
  "name": "@vbarbarosh/node-helpers",
5
- "version": "3.19.0",
5
+ "version": "3.19.1",
6
6
  "description": "A set of helpers for JavaScript/Node.js",
7
7
  "files": [
8
8
  "src"
package/src/fastdl.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const format_bytes = require('./format_bytes');
2
+ const format_percents = require('./format_percents');
2
3
  const format_seconds = require('./format_seconds');
3
4
  const format_thousands = require('./format_thousands');
4
5
  const fs = require('fs');
@@ -42,10 +43,10 @@ async function fastdl({file, read_stream_with_range, concurrency = 60, user_frie
42
43
  const bb = format_bytes;
43
44
  const ss = format_seconds;
44
45
  if (p.rate) {
45
- _(`${bb(p.done)} of ${bb(p.total)} [${(p.percentage*100).toFixed(2)}%] at ${bb(p.rate)}/s ETA ${ss(p.eta)} duration=${ss(p.duration)} connections=${connections}`);
46
+ _(`${bb(p.done)} of ${bb(p.total)} [${format_percents(p.percents)}] at ${bb(p.rate)}/s ETA ${ss(p.eta)} duration=${ss(p.duration)} connections=${connections}`);
46
47
  }
47
48
  else {
48
- _(`${bb(p.done)} of ${bb(p.total)} [${(p.percentage*100).toFixed(2)}%] at ~ ETA ${ss(p.eta)} duration=${ss(p.duration)} connections=${connections}`);
49
+ _(`${bb(p.done)} of ${bb(p.total)} [${format_percents(p.percents)}] at ~ ETA ${ss(p.eta)} duration=${ss(p.duration)} connections=${connections}`);
49
50
  }
50
51
  }
51
52