mirror of
https://github.com/danog/code-server.git
synced 2024-11-30 04:39:46 +01:00
Fix human readable byte size when zero
This commit is contained in:
parent
0462a93f11
commit
4a29cd1664
@ -505,9 +505,8 @@ class DialogEntryRenderer implements ITreeRenderer<DialogEntry, string, DialogEn
|
||||
*/
|
||||
private humanReadableSize(bytes: number): string {
|
||||
const units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
|
||||
const i = Math.min(Math.floor(Math.log(bytes) / Math.log(1000)), units.length - 1);
|
||||
const i = Math.min(Math.floor(bytes && Math.log(bytes) / Math.log(1000)), units.length - 1);
|
||||
|
||||
return (bytes / Math.pow(1000, i)).toFixed(2)
|
||||
+ " " + units[i];
|
||||
return (bytes / Math.pow(1000, i)).toFixed(2) + " " + units[i];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user