Skip to content

Function: instantiateDuckDB()

instantiateDuckDB(bundles, options?): Promise<AsyncDuckDB>

Defined in: duckdb.ts:62

Build an AsyncDuckDB from the app's bundles. The worker files are served same-origin, so a plain new Worker(url) is enough — no cross-origin Blob shim (which is only why duckdb-wasm's jsDelivr path wraps a Blob).

workerFactory is the instrumentation seam: an app that must wrap the worker (scratch's mosaic-taxi patches XHR/fetch inside it to meter DuckDB's S3 traffic honestly; a test can hand back a scripted stand-in) receives the selected bundle's worker URL and returns the Worker to use. Module URLs are passed to instantiate ABSOLUTE for the factory's sake: a factory that boots the real worker through a blob: bootstrap has no usable base URL, and absolute URLs cost a plain new Worker nothing.

Parameters

bundles

DuckDBBundles

options?

logger?

Logger

workerFactory?

(workerUrl) => Worker

Returns

Promise<AsyncDuckDB>