feat: 콘텐츠 수정 작업

This commit is contained in:
2025-04-18 14:40:39 +09:00
parent 9665189c95
commit 6c014fe0ce
19 changed files with 304 additions and 23 deletions
@@ -28,6 +28,10 @@ export const createColumns = (
{
accessorKey: "atflFlieSz",
header: "파일크기",
cell: ({ row }) => {
const size = row.getValue("atflFlieSz");
return size ? formatFileSize(Number(size)) : "0 Bytes";
},
},
{
@@ -60,3 +64,14 @@ export const createColumns = (
),
},
];
const formatFileSize = (bytes: number): string => {
console.log("bytes: ", bytes);
if (bytes === 0) return "0 Bytes";
const k = 1024;
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
};