(file: string, decimals = 2)
| 4 | const stat = util.promisify(fs.stat); |
| 5 | |
| 6 | export async function getFileSize(file: string, decimals = 2): Promise<string> { |
| 7 | try { |
| 8 | let statInfo = await stat(file); |
| 9 | return formatBytes(statInfo.size, decimals); |
| 10 | } catch (err) { |
| 11 | return "0 Bytes"; |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | export function getFileSizeSync(file: string, decimals = 2): string { |
| 16 | try { |
nothing calls this directly
no test coverage detected