MCPcopy Create free account
hub / github.com/6174/comflowyspace / getFileSizeSync

Function getFileSizeSync

apps/node/src/modules/utils/file-size.ts:15–22  ·  view source on GitHub ↗
(file: string, decimals = 2)

Source from the content-addressed store, hash-verified

13}
14
15export 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
24function formatBytes(bytes: number, decimals = 2) {
25 if (bytes === 0) return '0 Bytes';

Callers 1

ModelManagerClass · 0.90

Calls 1

formatBytesFunction · 0.85

Tested by

no test coverage detected