Skip to main content

Mojo function

open

open[PathLike: PathLike](path: PathLike, mode: StringSlice[origin]) -> FileHandle

Opens the file specified by path using the mode provided, returning a FileHandle.

Parameters:

  • PathLike (PathLike): The a type conforming to the os.PathLike trait.

Args:

  • path (PathLike): The path to the file to open.
  • mode (StringSlice[origin]): The mode to open the file in: {"r", "w", "rw"}.

Returns:

A file handle.

Raises:

If file open mode is not one of the supported modes. If there is an error when opening the file.

Was this page helpful?