question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

is there a way to retrieve how long an action has been going for?

See original GitHub issue

so in my code i am implementing a progress bar and i want to do something along the lines of this


var c = new Client();
  c.on('ready', function() {
    c.put(UP, UD, function(err, res) {
      if (err) console.log("ERROR:".warn + err.error);
      var len = parseInt(res.headers['content-length'], 10);
      console.log();
      var bar = new ProgressBar('uploading [:bar] :percent :etas', {
        complete: '=',
        incomplete: ' ',
        width: 20,
        total: 
      })
      c.end();
    });
  });

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
mscdexcommented, Jan 15, 2014

Well, I’m not sure about your particular use case, but here would be if you were uploading a local file:

var fs = require('fs');

var c = new Client();

// ...

c.on('ready', function() {
  var file = fs.createReadStream('bigfoo.dat'),
      cur = 0,
      total = fs.statSync('bigfoo.dat').size;
  file.on('data', function(d) {
    cur += d.length;
    console.log(((cur / total) * 100).toFixed(1) + '% complete');
  });
  c.put(file, UD, function(err) {
    if (err) throw err;
    console.log('Done uploading!');
    c.end();
  });
});
0reactions
cker321commented, Mar 28, 2019

666

Read more comments on GitHub >

github_iconTop Results From Across the Web

Undo, redo, or repeat an action - Microsoft Support
You can undo, redo, or repeat many actions in Microsoft Word, PowerPoint, and Excel. You can undo changes, even after you have saved,...
Read more >
Expressing a Future Action: The correct use fo Will and Going to
Articulate a future action by knowing how to correctly use the expressions "Will" and "Going to", and learning more about their differences.
Read more >
Using Verb Tenses - TERMIUM Plus® - Translation Bureau
The present perfect tense describes actions that began in the past and continue into the present or that have just been completed at...
Read more >
Action Blocked on Instagram: What Triggers and How to Get ...
The reason why such blocks are applied is the violation of multiple Instagram rules. If your account has been temporarily blocked several ...
Read more >
Windows 10 basics: how to use System Restore to go back in ...
You might lose some of the work you've done since you created that restore point, but you'd also lose any unwanted changes that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found