Skip to content

Function: withFileLock()

withFileLock<T>(key, fn, options?): Promise<T>

Run fn while holding a cross-process lock named by key.

key is canonicalized with object.toStableKey, the same identity rule as process and Postgres advisory locks.

T

unknown

() => T | Promise<T>

FileLockOptions = {}

Promise<T>

await withFileLock(["cache", "appkit"], async () => {
await migrate();
});