Capy-Bearer Documentation

file_temp

host call

Capy

function file_temp(prefix : string) string

Description

file_temp creates an empty file with a unique suffix.

Parameters

prefix : path prefix for the temporary file

Return Values

The new empty file path. Returns "" on failure.

Example

Capy

var path := file_temp("/tmp/doc-temp-")
if path != "" {
    file_put_contents(path, "scratch")
    print(file_get_contents(path), "\n")
    file_unlink(path)
}