Skip to content

Commit bd704f4

Browse files
nelakahmelsayed
authored andcommitted
Added progress bar
1 parent a8144eb commit bd704f4

File tree

3 files changed

+117
-19
lines changed

3 files changed

+117
-19
lines changed

src/Azure.Functions.Cli/npm/lib/install.js

+10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var fs = require('fs');
99
var rimraf = require('rimraf');
1010
var glob = require('glob');
1111
var execSync = require('child_process').execSync;
12+
var ProgressBar = require('progress');
1213

1314
function getPath() {
1415
var bin = path.resolve(path.join(path.dirname(__filename), '..', 'bin'));
@@ -20,8 +21,17 @@ function getPath() {
2021

2122
var url = 'https://functionscdn.azureedge.net/public/' + version + '/Azure.Functions.Cli.zip';
2223
https.get(url, function (response) {
24+
25+
var bar = new ProgressBar('[:bar] Downloading Azure Functions Cli', {
26+
total: Number(response.headers['content-length']),
27+
width: 18
28+
});
29+
2330
if (response.statusCode === 200) {
2431
var installPath = getPath();
32+
response.on('data', function(data) {
33+
bar.tick(data.length);
34+
})
2535
var unzipStream = unzipper.Extract({ path: installPath })
2636
.on('close', () => installWorkers(installPath));
2737
response.pipe(unzipStream);

src/Azure.Functions.Cli/npm/package-lock.json

+106-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Azure.Functions.Cli/npm/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"chalk": "^2.1.0",
2828
"command-exists": "^1.2.2",
2929
"glob": "^7.1.2",
30+
"progress": "^2.0.0",
3031
"rimraf": "^2.6.1",
3132
"tmp": "^0.0.33",
3233
"unzipper": "^0.8.9"

0 commit comments

Comments
 (0)