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

Function fileSize

scripts/util.ts:221–233  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

219
220/** Helper just to get and format a file's size for logging. */
221export async function fileSize(filePath: string) {
222 const text = await readFile(filePath);
223 const { default: compress } = await import('brotli/compress.js');
224
225 const data = compress(text, {
226 mode: 1,
227 quality: 11,
228 });
229 return {
230 original: formatFileSize(text.length),
231 brotli: formatFileSize(data.byteLength),
232 };
233}
234
235function formatFileSize(bytes: number) {
236 if (bytes === 0) return '0b';

Callers 3

submoduleCoreProdFunction · 0.90
submodulePreloaderFunction · 0.90
submoduleQwikLoaderFunction · 0.90

Calls 2

readFileFunction · 0.85
formatFileSizeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…