Skip to content

prepopulatedDataDir

prepopulatedDataDir(): Promise<Blob>

Defined in: prepopulated.ts:30

The prepopulated data directory, as a gzipped Store backup, for createPgwasm({ build, loadDataDir }):

import { createPgwasm } from "@pgxsinkit/pgwasm";
import { cBuild } from "@pgxsinkit/pgwasm-c";
import { prepopulatedDataDir } from "@pgxsinkit/pgwasm-c/prepopulated";
const pg = await createPgwasm({ build: cBuild, loadDataDir: await prepopulatedDataDir() });

It is fetched by URL, like the build’s other files, in Bun and in browsers. It is an asset of the pinned pgwasm-postgres release, made deterministically by that release’s own initdb; it is left unmarked, and createPgwasm adds the marker whenever it restores an unmarked backup, so every data directory created from it is marked as the C build’s. Its directories are 0750 and its files 0640; a restore does not carry a mode into the data directory. Like any backup of a running database it holds /postmaster.pid, recording the engine’s own process id: the C build treats it as stale and writes its own on start.

Promise<Blob>