node-json-db
Version:
Database using JSON file as storage for Node.JS
13 lines (12 loc) • 566 B
TypeScript
/**
* take a read lock that will be released when the function has finished running
* @param func
* @param timeout time in ms to wait to get the lock. Null mean infinite.
*/
export declare const readLockAsync: <T>(func: () => Promise<T>, timeout?: number | null) => Promise<T>;
/**
* Take a write lock that will be released when the function has finished running
* @param func
* @param timeout time in ms to wait to get the lock. Null mean infinite.
*/
export declare const writeLockAsync: <T>(func: () => Promise<T>, timeout?: number | null) => Promise<T>;