Skip to content
// EFFECT DAYS 2026

BunWorker unstable

Parent-side worker support for Bun applications.

layerPlatform provides the WorkerPlatform used to communicate with globalThis.Worker instances through Effect's worker protocol. layer combines that platform with a Spawner built from a callback that creates a worker for each worker id. The platform forwards worker messages and errors, asks workers to close on scope finalization, and terminates them if graceful shutdown times out.

2 exports Since v4.0.0 Source

Layers

layer

unstable
Since v4.0.0

Provides the Bun WorkerPlatform together with a Worker.Spawner created from the supplied worker spawning function.

Signature

declare function layer(spawn: (id: number) => Worker): Layer<WorkerPlatform | Spawner>
Since v4.0.0

Provides the Bun WorkerPlatform, wiring worker messages and errors into Effect workers and requesting graceful worker shutdown during scope finalization before terminating workers that have not closed within Worker.CloseTimeout.

Signature

declare const layerPlatform: Layer<WorkerPlatform, never, never>