Skip to content

createLayerFromFs

createLayerFromFs(fs, parent, command?): Promise<Layer>

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

Build a Layer object from a frozen memoryFS.

FrozenMemoryFS

Frozen memoryFS holding the layer’s diff content.

string | undefined

Parent layer id, or undefined for the base layer.

string

Optional build command that produced this layer.

Promise<Layer>

A fully-populated Layer.

Computes content hash and size in parallel, derives the chain-aware id via chainAwareId, and stamps created with Date.now(). The returned layer is ready to hand to LayerStore.put. Shared by the builder’s .run() path and container commit.

import { createLayerFromFs, createLayerStore } from '@fishnet/core'
const store = createLayerStore()
const layer = await createLayerFromFs(frozenFs, undefined, 'echo base')
store.put(layer)