tangled
alpha
login
or
join now
pds.ls
/
pdsls
398
fork
atom
atmosphere explorer
pds.ls
tool
typescript
atproto
398
fork
atom
overview
issues
1
pulls
pipelines
use binary notation for filesizes
handle.invalid
1 week ago
3a608500
e3b35589
verified
This commit was signed with the committer's
known signature
.
handle.invalid
SSH Key Fingerprint:
SHA256:mBrT4x0JdzLpbVR95g1hjI1aaErfC02kmLRkPXwsYCk=
+1
-1
1 changed file
expand all
collapse all
unified
split
src
utils
format.ts
+1
-1
src/utils/format.ts
···
1
1
const formatFileSize = (bytes: number): string => {
2
2
if (bytes === 0) return "0 B";
3
3
const k = 1024;
4
4
-
const sizes = ["B", "KB", "MB", "GB"];
4
4
+
const sizes = ["B", "KiB", "MiB", "GiB"];
5
5
const i = Math.floor(Math.log(bytes) / Math.log(k));
6
6
return `${(bytes / Math.pow(k, i)).toFixed(i === 0 ? 0 : 1)} ${sizes[i]}`;
7
7
};