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.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”unknown
() => T | Promise<T>
options?
Section titled “options?”FileLockOptions = {}
Returns
Section titled “Returns”Promise<T>
Example
Section titled “Example”await withFileLock(["cache", "appkit"], async () => { await migrate();});