Module fs/temp
fs/temp
RAII-managed temporary files and directories.
Example
{ TempDir } :: import "std/fs/temp";
main :: (fn(using(io : IO)) -> unit)({
given(exn) : Exception = {
throw : (fn(forall(T : Type), error: AnyError) -> T)(
{ println(error.to_string()); exit(i32(1)); }
)
};
dir := io.await(TempDir.new());
println(dir.path());
io.await(dir.remove());
});
Types
TempDir
object
TempDir
Temporary directory that can be cleaned up with remove.
Fields
| Name | Type | Description |
|---|---|---|
_path | Path | |
_removed | bool |
impl(TempDir, ...)
new_in : (TempDir) fn(parent : Path, using(io : IO)) -> Impl(Future(TempDir, IO, Exception))new : (TempDir) fn(using(io : IO)) -> Impl(Future(TempDir, IO, Exception))
TempFile
object