cleanup, docs
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
file_temp
|
||||
:sig
|
||||
String file_temp(String prefix)
|
||||
|
||||
Filesystem nicety added to the wasm host membrane. Path arguments are policy-gated; operations return an empty value or false on denial/error. file_fsync() takes an open file handle and flushes it with fsync().
|
||||
:params
|
||||
prefix : path prefix for the temp file; a unique suffix is appended
|
||||
return value : the path of the newly created temp file, or "" on failure
|
||||
|
||||
:content
|
||||
Creates a new, uniquely named empty file using `prefix` as the leading path and returns its full path. Use it for scratch files and the write-then-rename publish pattern.
|
||||
|
||||
:example
|
||||
String path = file_temp("/tmp/doc-temp-");
|
||||
file_put_contents(path, "scratch");
|
||||
print(str_starts_with(path, "/tmp/doc-temp-") ? "created a temp file" : path, "\n");
|
||||
file_unlink(path);
|
||||
|
||||
:see
|
||||
>sys
|
||||
|
||||
:example
|
||||
print("file_temp example\n");
|
||||
file_rename
|
||||
file_put_contents
|
||||
|
||||
Reference in New Issue
Block a user