IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.2.0
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).

stat

Provides constants and functions for interpreting file mode bits.

This module defines file type constants and functions for testing file modes, similar to Python's stat module. It includes bit masks for identifying different file types (regular files, directories, symbolic links, devices, etc.) and convenience functions for mode testing.

comptime values​

S_IFBLK​

comptime S_IFBLK = 24576

Bits that determine the block device.

S_IFCHR​

comptime S_IFCHR = 8192

Bits that determine the char device.

S_IFDIR​

comptime S_IFDIR = 16384

Bits that determine the directory.

S_IFIFO​

comptime S_IFIFO = 4096

Bits that determine the fifo.

S_IFLNK​

comptime S_IFLNK = 40960

Bits that determine the symlink.

S_IFMT​

comptime S_IFMT = 61440

Bits that determine the file type.

S_IFREG​

comptime S_IFREG = 32768

Bits that determine the regular file.

S_IFSOCK​

comptime S_IFSOCK = 49152

Bits that determine the socket.

Functions​

  • ​S_ISBLK: Returns True if the mode is a block device.
  • ​S_ISCHR: Returns True if the mode is a character device.
  • ​S_ISDIR: Returns True if the mode is a directory.
  • ​S_ISFIFO: Returns True if the mode is a fifo.
  • ​S_ISLNK: Returns True if the mode is a symlink.
  • ​S_ISREG: Returns True if the mode is a regular file.
  • ​S_ISSOCK: Returns True if the mode is a socket.