mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
37 lines
1.5 KiB
TypeScript
37 lines
1.5 KiB
TypeScript
// Type definitions for proper-lockfile 3.0
|
|
// Project: https://github.com/moxystudio/node-proper-lockfile
|
|
// Definitions by: Nikita Volodin <https://github.com/qlonik>
|
|
// Linus Unnebäck <https://github.com/LinusU>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
export interface LockOptions {
|
|
stale?: number; // default: 10000
|
|
update?: number; // default: stale/2
|
|
retries?: number; // default: 0
|
|
realpath?: boolean; // default: true
|
|
fs?: any; // default: graceful-fs
|
|
onCompromised?: (err: Error) => any; // default: (err) => throw err
|
|
lockfilePath?: string; // default: `${file}.lock`
|
|
}
|
|
|
|
export interface UnlockOptions {
|
|
realpath?: boolean; // default: true
|
|
fs?: any; // default: graceful-fs
|
|
lockfilePath?: string; // default: `${file}.lock`
|
|
}
|
|
|
|
export interface CheckOptions {
|
|
stale?: number; // default: 10000
|
|
realpath?: boolean; // default: true
|
|
fs?: any; // default: graceful-fs
|
|
lockfilePath?: string; // default: `${file}.lock`
|
|
}
|
|
|
|
export function lock(file: string, options?: LockOptions): Promise<() => Promise<void>>;
|
|
export function unlock(file: string, options?: UnlockOptions): Promise<void>;
|
|
export function check(file: string, options?: CheckOptions): Promise<boolean>;
|
|
|
|
export function lockSync(file: string, options?: LockOptions): () => void;
|
|
export function unlockSync(file: string, options?: UnlockOptions): void;
|
|
export function checkSync(file: string, options?: CheckOptions): boolean;
|