@thi.ng/file-io
Version:
Assorted file I/O utils (w/ logging support) for NodeJS/Bun
26 lines • 907 B
TypeScript
import type { TypedArray } from "@thi.ng/api";
import type { ILogger } from "@thi.ng/logger";
/**
* Constructs a temp file path using {@link tempFilePath} and writes `body` to
* this path, then returns path. If `name` is given and contains
* sub-directories, they will be created automatically.
*
* @param body
* @param logger
* @param name
* @param ext
*/
export declare const createTempFile: (body: string | TypedArray, logger?: ILogger, name?: string, ext?: string) => string;
/**
* Constructs a file path in the system-defined temp directory, optionally using
* provided basename and/or file extension.
*
* @remarks
* If no `name` is given, constructs a random filename of `tmp-XXX` (16 random
* chars). Default extension is an empty string.
*
* @param name
* @param ext
*/
export declare const tempFilePath: (name?: string, ext?: string) => string;
//# sourceMappingURL=temp.d.ts.map