added file size
This commit is contained in:
7
src/functions/sizeToReadable.ts
Normal file
7
src/functions/sizeToReadable.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
function sizeToReadable(size: number): string {
|
||||
const i = Math.floor(Math.log(size) / Math.log(1024))
|
||||
return (size / Math.pow(1024, i)).toFixed(2) + " " + ["B", "kB", "MB", "GB", "TB"][i]
|
||||
|
||||
}
|
||||
|
||||
export default sizeToReadable
|
||||
Reference in New Issue
Block a user