Error type for OS operations (a human-readable message).
Module Os
Operating system interfaces for paths, files, directories, standard streams, and environment variables.
Most operations return Result<Os.Error, ...>.
type Os.Path = iterative@append recursive@parent box choice { .absolute => Bytes, .append => [Bytes] self@append, .name => Bytes, .parent => Option<self@parent>, .parts => List<Bytes>, }
A filesystem path value.
.name— get the file name component as bytes..absolute— get the absolute path as bytes..parts— get all path components as a list of byte sequences..parent— get the parent path, or.err!if at root..append(part)— return a path with one more path component.
type Os.Reader = Bytes.Reader<Os.Error>
A byte reader for OS I/O, with Os.Error as the error type.
type Os.Writer = Bytes.Writer<Os.Error>
A byte writer for OS I/O, with Os.Error as the error type.
dec Os.AppendToFile : [Os.Path] Result<Os.Error, Os.Writer>
Opens an existing file for appending. Fails if the file does not exist.
Creates a directory and all necessary parent directories.
dec Os.CreateNewFile : [Os.Path] Result<Os.Error, Os.Writer>
Creates a new file for writing. Fails if the file already exists.
dec Os.CreateOrAppendToFile : [Os.Path] Result<Os.Error, Os.Writer>
Opens or creates a file for appending.
dec Os.CreateOrReplaceFile : [Os.Path] Result<Os.Error, Os.Writer>
Creates or replaces a file for writing. Truncates if the file already exists.
dec Os.Env : BoxMap.Readonly<Bytes, Bytes>
Read-only view of the process environment variables.
Lists the entries of a directory, returning a list of paths sorted by name.
Opens a file for reading.
Creates a Path from its byte representation.
Standard error as a byte writer.
Standard input as a byte reader.
Standard output as a byte writer.
dec Os.TraverseDir : [Os.Path] Result<Os.Error, recursive either { .dir (Os.Path, self) self, .end !, .file (Os.Path) self, }>
Recursively traverses a directory tree, returning a nested structure of files and subdirectories sorted by name.
.end!— no more entries..file(path) rest— a file, followed by more entries..dir(path, children) rest— a subdirectory with its nested contents, followed by more entries.