GetTempFileName (temp file path)
ts
function GetTempFileName(): string;Generates and returns a unique temporary file path in the OS's default temporary directory. The file is not created; only the path is returned. It is the script's responsibility to create, use, and clean up the file.
| Return value | Explanation |
|---|---|
| string | A unique temporary file path, e.g. /tmp/syncjs-a1b2c3d4 |
TIP
Always delete the temporary file after use to avoid leaving stale files in the temp directory.
Example
ts
var tmp = GetTempFileName();
WriteTextToFile(tmp, 'temporary content');
// ... process the file ...
DelFile(tmp);