Module fs/file
fs/file
Async file I/O operations with Exception-based error handling.
Wraps a file descriptor with typed async I/O operations.
Uses the Exception effect for error handling.
Example
{ File, read_string, write_file, OpenMode } :: import "std/fs/file";
main :: (fn(io : Io, exn : Exception) -> unit)({
// Write a file
io.await(write_file(Path.new(`test.txt`), `hello world`, io), { io, exn });
// Read it back
content := io.await(read_string(Path.new(`test.txt`), io), { io, exn });
println(content);
// Open with OpenMode
f := io.await(File.open(Path.new(`test.txt`), .Read, io), { io, exn });
});
Types
File
struct
File
Trait Implementations
Dispose