cleanup, docs
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
file_rename
|
||||
:sig
|
||||
bool file_rename(String from, String to)
|
||||
|
||||
Structural filesystem operation across the wasm host membrane. All path arguments are policy-gated through the same guest file/write roots as other file APIs and return false on denial or OS error.
|
||||
:params
|
||||
from : source path
|
||||
to : destination path
|
||||
return value : true on success
|
||||
|
||||
:content
|
||||
Renames or moves a file. After a successful rename the source path no longer exists. Use it for atomic publish patterns: write a temp file, then rename it into place.
|
||||
|
||||
:example
|
||||
file_put_contents("/tmp/doc-rename-a.txt", "moved");
|
||||
file_rename("/tmp/doc-rename-a.txt", "/tmp/doc-rename-b.txt");
|
||||
print(file_get_contents("/tmp/doc-rename-b.txt"), " / source ", file_exists("/tmp/doc-rename-a.txt") ? "exists" : "gone", "\n");
|
||||
|
||||
:see
|
||||
>sys
|
||||
|
||||
:example
|
||||
print("file_rename example\n");
|
||||
file_copy
|
||||
file_temp
|
||||
|
||||
Reference in New Issue
Block a user