Skip to content

computeLayerSize

computeLayerSize(fs): Promise<number>

Defined in: packages/core/src/kernel/layer.ts:318

Compute total byte size of all files in a frozen memoryFS (the diff content).

FrozenMemoryFS

Frozen memoryFS whose content should be measured.

Promise<number>

Total bytes across all non-whiteout files.

Recursively sums Stat.size for every file reachable from the FS root. Whiteouts are skipped — they carry no content. This is what populates Layer.size during createLayerFromFs.

import { computeLayerSize } from '@fishnet/core'
const bytes = await computeLayerSize(frozenFs)
console.log(`layer diff: ${bytes} bytes`)