(file: string, decimals = 2)
| 13 | } |
| 14 | |
| 15 | export function getFileSizeSync(file: string, decimals = 2): string { |
| 16 | try { |
| 17 | let statInfo = fs.statSync(file); |
| 18 | return formatBytes(statInfo.size, decimals); |
| 19 | } catch(err: any) { |
| 20 | return "0 Bytes" + err.message; |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | function formatBytes(bytes: number, decimals = 2) { |
| 25 | if (bytes === 0) return '0 Bytes'; |
no test coverage detected