makeTemporaryFile
Creates a temporary file.
Example
ts
import { SF } from "@duplojs/server-utils";
import { E, unwrap } from "@duplojs/utils";
const result = await SF.makeTemporaryFile("tmp-", ".log");
// result: E.Success<string> | SF.FileSystemLeft
if (E.isRight(result)) {
const tmpFile = unwrap(result);
// tmpFile: string
}
const report = await SF.makeTemporaryFile("report-");Syntax
typescript
function makeTemporaryFile(
prefix: string,
suffix?: string
): Promise<FileSystemLeft | E.Success<string>>Parameters
prefix: prefix for the temporary file.suffix: optional suffix (e.g., extension).
Return value
E.Success<string>: path of the temporary file.FileSystemLeft: if creation fails.
See also
makeTemporaryDirectory- Creates a temporary directory.
