For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
os
Provides functions to access operating-system dependent functionality, including file system operations.
You can import a method from the os package. For example:
from std.os import listdir
comptime values
SEEK_CUR
comptime SEEK_CUR = UInt8(1)
Seek from the current position.
SEEK_END
comptime SEEK_END = UInt8(2)
Seek from the end of the file.
SEEK_SET
comptime SEEK_SET = UInt8(0)
Seek from the beginning of the file.
sep
comptime sep = "/"
The path separator for the current platform.
Functions
-
abort: Terminates execution, using a target dependent trap instruction if available. -
getuid: Retrieve the user ID of the calling process. -
isatty: Checks whether a file descriptor refers to a terminal. -
link: Creates a new hard-link to an existing file. -
listdir: Gets the list of entries contained in the path provided. -
makedirs: Creates a specified leaf directory along with any necessary intermediate directories that don't already exist. -
mkdir: Creates a directory at the specified path. -
remove: Removes the specified file. -
removedirs: Removes a leaf directory and all empty intermediate ones. -
rmdir: Removes the specified directory. -
symlink: Creates a symlink. -
unlink: Removes the specified file.