Skip to content

Commit

Permalink
Fixed digits for progress indicator example
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldietrich committed Dec 25, 2019
1 parent 2ec47c5 commit 07d94ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ async function copyWithProgress(src: string, dst: string, callback: (curr: copy.
// usage
(async function() {
copyWithProgress('node_modules', 'temp', (curr, sum) => {
console.log(`${Math.floor(curr.size / sum.size * 100)} %`);
const progress = Math.min(100, Math.floor(curr.size / sum.size * 100));
console.log(`${Number.parseFloat(progress).toFixed(1)} %`);
});
})();
```
Expand Down

0 comments on commit 07d94ce

Please sign in to comment.