[st frontend] as 사용자 뷰 정보 표시 정리
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
/* Shared file utilities for apps/as */
|
||||
|
||||
/** 파일 크기는 byte 단위로 제공된다고 가정하고 크기에 따라서 KB, MB 단위로 표시 */
|
||||
export const formatFileSize = (bytes?: number | null): string => {
|
||||
if (bytes === null || bytes === undefined) return "-";
|
||||
const b = Number(bytes) || 0;
|
||||
if (b >= 1024 * 1024) return `${(b / 1024 / 1024).toFixed(1)}MB`;
|
||||
if (b >= 1024) return `${Math.round(b / 1024)}KB`;
|
||||
return `${b}B`;
|
||||
};
|
||||
|
||||
export default { formatFileSize };
|
||||
Reference in New Issue
Block a user