cleanup, docs
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
file_truncate
|
||||
:sig
|
||||
bool file_truncate(String path, u64 size)
|
||||
|
||||
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
|
||||
path : file to resize
|
||||
size : new length in bytes
|
||||
return value : true on success
|
||||
|
||||
:content
|
||||
Truncates (or extends) a file to exactly `size` bytes. Shrinking discards trailing bytes; growing pads with zero bytes.
|
||||
|
||||
:example
|
||||
file_put_contents("/tmp/doc-truncate.txt", "hello world");
|
||||
file_truncate("/tmp/doc-truncate.txt", 5);
|
||||
print(file_get_contents("/tmp/doc-truncate.txt"), "\n");
|
||||
|
||||
:see
|
||||
>sys
|
||||
|
||||
:example
|
||||
print("file_truncate example\n");
|
||||
file_put_contents
|
||||
file_stat
|
||||
|
||||
Reference in New Issue
Block a user