UNPKG

886 BTypeScriptView Raw
1type LockInitResponse = {
2 writeAndUnlock: (data: string) => Promise<void>;
3 unlock: () => Promise<void>;
4};
5type LockInitSyncResponse = {
6 writeAndUnlock: (data: string) => void;
7 unlock: () => void;
8};
9/**
10 *
11 *This method exists as a separate function so it can be used by ConfigFile OR outside of ConfigFile.
12 *
13 * @param filePath where to save the file
14 * @returns 2 functions:
15 * - writeAndUnlock: a function that takes the data to write and writes it to the file, then unlocks the file whether write succeeded or not
16 * - unlock: a function that unlocks the file (in case you don't end up calling writeAndUnlock)
17 */
18export declare const lockInit: (filePath: string) => Promise<LockInitResponse>;
19/**
20 * prefer async {@link lockInit}.
21 * See its documentation for details.
22 */
23export declare const lockInitSync: (filePath: string) => LockInitSyncResponse;
24export {};