lib/os
import "github.com/eugenioenko/goalchemy/lib/os"Package os reads and writes whole host files.
| Function | c | csharp | go | java | python | rust | swift | typescript |
|---|---|---|---|---|---|---|---|---|
ReadFile |
yes | yes | yes | yes | yes | yes | yes | yes |
WriteFile |
yes | yes | yes | yes | yes | yes | yes | yes |
ReadFile
Section titled “ReadFile”func ReadFile(name string) ([]byte, int)Reads a whole host file and reports a portable status code.
- Gate:
sequential(never suspends) - Determinism: nondeterministic
- Bounds: Files larger than MaxFileBytes (1 GiB) report TooLarge without returning data.
- Errors: Missing paths report NotExist; access denial Permission; reading a directory IsDir; a non-directory path component NotDir; hosts without a file system Unsupported; other host failures IO.
- Contract:
lib.os.read_file1.0.0
WriteFile
Section titled “WriteFile”func WriteFile(name string, data []byte, perm uint32) intCreates or truncates a host file and writes data, reporting a portable status code.
- Gate:
sequential(never suspends) - Determinism: nondeterministic
- Bounds: Data larger than MaxFileBytes (1 GiB) reports TooLarge without touching the file.
- Errors: A missing parent directory reports NotExist; access denial Permission; a directory name IsDir; a non-directory path component NotDir; hosts without a file system Unsupported; other host failures IO. A failure after truncation can leave a partial file, as in Go.
- Contract:
lib.os.write_file1.0.0