first commit

This commit is contained in:
AyrisAI
2026-05-14 01:57:52 +03:00
parent 863a32cd35
commit 4a9196f483
47 changed files with 12043 additions and 102 deletions

13
lib/format.ts Normal file
View File

@@ -0,0 +1,13 @@
/**
* Byte cinsinden değeri okunabilir formata çevirir.
* Örn: 3221225472 → "3 GB", 524288000 → "500 MB"
*/
export function formatBytes(bytes: number): string {
if (bytes === 0) return "0 MB";
const mb = bytes / (1024 * 1024);
if (mb >= 1024) {
const gb = mb / 1024;
return gb % 1 === 0 ? `${gb} GB` : `${gb.toFixed(1)} GB`;
}
return mb % 1 === 0 ? `${mb} MB` : `${mb.toFixed(1)} MB`;
}