Convert formatBytes to TypeScript

This commit is contained in:
Bogdan
2024-08-15 03:49:37 +03:00
parent 5cbbd060a4
commit 379071f838

View File

@@ -1,6 +1,6 @@
import { filesize } from 'filesize'; import { filesize } from 'filesize';
function formatBytes(input) { function formatBytes(input: string | number) {
const size = Number(input); const size = Number(input);
if (isNaN(size)) { if (isNaN(size)) {
@@ -9,7 +9,7 @@ function formatBytes(input) {
return `${filesize(size, { return `${filesize(size, {
base: 2, base: 2,
round: 1 round: 1,
})}`; })}`;
} }