MCPcopy
hub / github.com/QwikDev/qwik / formatFileSize

Function formatFileSize

scripts/util.ts:235–242  ·  view source on GitHub ↗
(bytes: number)

Source from the content-addressed store, hash-verified

233}
234
235function formatFileSize(bytes: number) {
236 if (bytes === 0) return '0b';
237 const k = 1024;
238 const dm = bytes < k ? 0 : 1;
239 const sizes = ['b', 'kb'];
240 const i = Math.floor(Math.log(bytes) / Math.log(k));
241 return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + '' + sizes[i];
242}
243
244export const access = /*#__PURE__*/ promisify(fsAccess);
245export const copyFile = /*#__PURE__*/ promisify(fsCopyFile);

Callers 1

fileSizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…