@alwatr/node-fs
Version:
Enhanced file system operations in Node.js with asynchronous queue to prevent parallel writes.
36 lines • 1.01 kB
TypeScript
/**
* Enhanced write json file (Asynchronous).
*
* @param path - file path
* @param data - json object
* @example
* ```typescript
* await writeJsonFile('./file.json', { a:1, b:2, c:3 });
* ```
*/
export declare function writeJson<T extends JsonValue>(path: string, data: T, sync?: false): Promise<void>;
/**
* Enhanced write json file (Synchronous).
*
* @param path - file path
* @param data - json object
* @param sync - sync mode
* @example
* ```typescript
* writeJsonFile('./file.json', { a:1, b:2, c:3 }, true);
* ```
*/
export declare function writeJson<T extends JsonValue>(path: string, data: T, sync: true): void;
/**
* Enhanced write json file.
*
* @param path - file path
* @param data - json object
* @param sync - sync mode
* @example
* ```typescript
* await writeJsonFile('./file.json', { a:1, b:2, c:3 }, sync);
* ```
*/
export declare function writeJson<T extends JsonValue>(path: string, data: T, sync: boolean): Awaitable<void>;
//# sourceMappingURL=write-json.d.ts.map