@thi.ng/file-io
Version:
Assorted file I/O utils (w/ logging support) for NodeJS/Bun
26 lines • 937 B
TypeScript
import type { TypedArray } from "@thi.ng/api";
import type { ILogger } from "@thi.ng/logger";
import { type WriteFileOptions } from "node:fs";
/**
* Writes `body` as to given `path` (using optional `opts` to define encoding).
* If `dryRun` is true (default: false), the file WON'T be written, however if a
* `logger` is provided then at least a dry-run log message will be emitted.
*
* @param path
* @param body
* @param opts
* @param logger
* @param dryRun
*/
export declare const writeFile: (path: string, body: string | TypedArray, opts?: WriteFileOptions, logger?: ILogger, dryRun?: boolean) => void;
/**
* Async version of {@link writeFile}.
*
* @param path
* @param body
* @param opts
* @param logger
* @param dryRun
*/
export declare const writeFileAsync: (path: string, body: string | TypedArray, opts?: WriteFileOptions, logger?: ILogger, dryRun?: boolean) => Promise<void>;
//# sourceMappingURL=write.d.ts.map