MCPcopy Create free account
hub / github.com/npkgz/cli-progress / Example2

Function Example2

examples/example.js:45–76  ·  view source on GitHub ↗
(onComplete)

Source from the content-addressed store, hash-verified

43
44
45function Example2(onComplete){
46 // EXAMPLE 2 ---------------------------------------------
47 console.log('\nExample 2 - Custom configuration');
48
49 // create new progress bar using default values
50 const b2 = new _progress.Bar({
51 barCompleteChar: '#',
52 barIncompleteChar: '_',
53 format: ' |- Current Upload Progress: {percentage}%' + ' - ' + '||{bar}||',
54 fps: 5,
55 stream: process.stdout,
56 barsize: 30
57 });
58 b2.start(100, 0);
59
60 // 50ms update rate
61 const timer = setInterval(function(){
62 // increment value
63 b2.increment();
64
65 // set limit
66 if (b2.value >= b2.getTotal()){
67 // stop timer
68 clearInterval(timer);
69
70 b2.stop();
71
72 // run complete callback
73 onComplete.apply(this);
74 }
75 }, 50);
76}
77
78function Example3(onComplete){
79 // EXAMPLE 3 ---------------------------------------------

Callers 1

example.jsFile · 0.85

Calls 5

logMethod · 0.80
incrementMethod · 0.80
getTotalMethod · 0.80
startMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…