makeTempFileSync
import { makeTempFileSync } from "jsr:@ende/fs/unstable-make-temp-file";function · experimental · requires --allow-write
function makeTempFileSync(options?: MakeTempOptions): stringSynchronously creates a new temporary file in the default directory for
temporary files, unless dir is specified.
Other options include prefixing and suffixing the directory name with
prefix and suffix respectively.
The full path to the newly created file is returned.
Multiple programs calling this function simultaneously will create different files. It is the caller's responsibility to remove the file when no longer needed.
Requires allow-write permission.
options?: MakeTempOptionsThe options specified when creating a temporary file.
Returns
The file path to the temporary file.
Example: Usage
import { makeTempFileSync } from "@ende/fs/unstable-make-temp-file";
const tempFileName0 = makeTempFileSync(); // e.g. /tmp/419e0bf2
const tempFileName1 = makeTempFileSync({ prefix: 'my_temp' }); // e.g. /tmp/my_temp754d3098