(bytes)
| 1 | import { getCookie } from "@/shared/utils/common"; |
| 2 | |
| 3 | export 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 | |
| 12 | export function convertImgPath(path: string, isGuest = false) { |
| 13 | return new Promise((resolve, reject) => { |
no outgoing calls
no test coverage detected