node.js - Node progress bar -
i working on example presented in https://github.com/tj/node-progress
i have followed example word word, can't seem functionality of bar.tick() working
var req = http.request({ host: 'download.github.com', port: 443, path: '/visionmedia-node-jscoverage-0d4608a.zip' }); req.on('response', function (res) { //var body = ""; var len = parseint(res.headers['content-length'], 10); console.log(); var bar = new progressbar(' downloading :bar :percent :etas', { complete: '=', incomplete: ' ', width: 20, total: len }); res.on('data', function (chunk) { //body += chunk; bar.tick(chunk.length); }); res.on('end', function () { console.log('\nfinished loading\n'); }); }); req.end();
the final output looks following
downloading ==================== 100% 0.0s
but instead should show progress data received until complete
ensure you're downloading something, file have been deleted or download instantly completing because there's nothing download.
Comments
Post a Comment