Skip to content

Commit

Permalink
Added progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
nelak authored and ahmelsayed committed Dec 1, 2017
1 parent a8144eb commit bd704f4
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 19 deletions.
10 changes: 10 additions & 0 deletions src/Azure.Functions.Cli/npm/lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var fs = require('fs');
var rimraf = require('rimraf');
var glob = require('glob');
var execSync = require('child_process').execSync;
var ProgressBar = require('progress');

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

var url = 'https://functionscdn.azureedge.net/public/' + version + '/Azure.Functions.Cli.zip';
https.get(url, function (response) {

var bar = new ProgressBar('[:bar] Downloading Azure Functions Cli', {
total: Number(response.headers['content-length']),
width: 18
});

if (response.statusCode === 200) {
var installPath = getPath();
response.on('data', function(data) {
bar.tick(data.length);
})
var unzipStream = unzipper.Extract({ path: installPath })
.on('close', () => installWorkers(installPath));
response.pipe(unzipStream);
Expand Down
125 changes: 106 additions & 19 deletions src/Azure.Functions.Cli/npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/Azure.Functions.Cli/npm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"chalk": "^2.1.0",
"command-exists": "^1.2.2",
"glob": "^7.1.2",
"progress": "^2.0.0",
"rimraf": "^2.6.1",
"tmp": "^0.0.33",
"unzipper": "^0.8.9"
Expand Down

0 comments on commit bd704f4

Please sign in to comment.