@stryke/fs
Version:
A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.
35 lines (34 loc) • 1.22 kB
text/typescript
import { Encoding } from "./constants.cjs";
import { Abortable } from "node:events";
import { Mode, ObjectEncodingOptions, OpenMode, WriteFileOptions as WriteFileOptions$1 } from "node:fs";
//#region src/write-file.d.ts
interface WriteFileOptions {
/**
* Whether to create the directory if it does not exist
*
* @defaultValue true
*/
createDirectory?: boolean;
}
/**
* Write the given content to the given file path
*
* @param filePath - The file path to write to
* @param content - The content to write to the file
*/
declare const writeFileSync: (filePath: string, content?: string, options?: WriteFileOptions & WriteFileOptions$1) => void;
/**
* Read the given content to the given file path
*
* @param filePath - The file path to read to
* @param content - The content to write to the file
* @returns The content of the file
*/
declare const writeFile: (filePath: string, content?: string, options?: WriteFileOptions & ((ObjectEncodingOptions & {
mode?: Mode | undefined;
flag?: OpenMode | undefined;
flush?: boolean | undefined;
} & Abortable) | Encoding)) => Promise<void>;
//#endregion
export { WriteFileOptions, writeFile, writeFileSync };
//# sourceMappingURL=write-file.d.cts.map