Mojo module
tempfile
Temporary file and directory creation.
This module provides a safe API for creating temporary files and directories.
It includes helpers for creating temporary directories (mkdtemp),
temporary files (NamedTemporaryFile), querying the default temporary
directory (gettempdir), and a context manager for managing the lifetime of
temporary directories (TemporaryDirectory).
To use these features, import the desired functions or classes from this module.
# Import from the tempfile module
from std.tempfile import gettempdircomptime values
TMP_MAX
comptime TMP_MAX = 10000
Maximum number of attempts when generating unique temporary file names.
Structs
-
NamedTemporaryFile: Temporary file with automatic cleanup. -
TemporaryDirectory: Temporary directory that cleans up automatically.
Functions
-
gettempdir: Return the default directory to use for temporary files. -
mkdtemp: Create a temporary directory.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!