MCPcopy Create free account
hub / github.com/ModelEngine-Group/app-platform / bytesToSize

Function bytesToSize

frontend/src/common/util.ts:3–10  ·  view source on GitHub ↗
(bytes)

Source from the content-addressed store, hash-verified

1import { getCookie } from "@/shared/utils/common";
2
3export function bytesToSize(bytes) {
4 if (!bytes) return '--';
5 if (bytes === 0) return '0 B';
6 let k = 1024,
7 sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
8 i = Math.floor(Math.log(bytes) / Math.log(k));
9 return (bytes / Math.pow(k, i)).toFixed(2) + ' ' + sizes[i];
10}
11
12export function convertImgPath(path: string, isGuest = false) {
13 return new Promise((resolve, reject) => {

Callers 4

DraggerUploadFunction · 0.90
getDetailFunction · 0.90
UploadFormFunction · 0.90
UploadAppFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected