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).
mkdtemp
def mkdtemp(suffix: String = "", prefix: String = "tmp", dir: Optional[String] = None) -> String
Create a temporary directory.
Caller is responsible for deleting the directory when done with it.
Example:
from std.tempfile import mkdtemp
from std.os import rmdir
var temp_dir = mkdtemp()
print(temp_dir)
rmdir(temp_dir)
Args:
- suffix (
String): Suffix to use for the directory name. - prefix (
String): Prefix to use for the directory name. - dir (
Optional[String]): Directory in which the directory will be created.
Returns:
String: The name of the created directory.
Raises:
If the directory can not be created.