Skip to main content

Mojo module

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.

Was this page helpful?