2024-07-03 13:04:46 -04:00
|
|
|
export const formatBytes = (bytes) => {
|
2024-10-17 12:05:06 +08:00
|
|
|
if (bytes === 0) return "0 Bytes";
|
|
|
|
|
const megabytes = bytes / (1024 * 1024);
|
|
|
|
|
return megabytes.toFixed(2) + " MB";
|
2024-07-03 13:04:46 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const checkImage = (url) => {
|
2024-10-17 12:05:06 +08:00
|
|
|
const img = new Image();
|
|
|
|
|
img.src = url;
|
|
|
|
|
return img.naturalWidth !== 0;
|
|
|
|
|
};
|