Tea
DocsPlaygroundExamplesReferenceCommunity
GitHub

Tea Language

A strongly typed scripting language for native tools.

© 2026 Tea Language.

ContributingCommunityRepository

Language Runtime

Built-ins

Standard Library

std.argsstd.assertstd.audiostd.envstd.fsstd.httpstd.netstd.jsonstd.parsestd.pathstd.processstd.regexstd.stringstd.timestd.url

Standard Library

std.fs

Filesystem operations for reading, writing, and managing files and directories.

Exported functions

pub def read_file(file_path: String) -> String

Read a text file.

pub def read_bytes(file_path: String) -> List[Int]

Read a file as raw bytes.

pub def write_file(file_path: String, content: String) -> Void

Write text to a file.

pub def write_file_atomic(file_path: String, content: String) -> Void

Write text to a file atomically.

pub def write_bytes(file_path: String, data: List[Int]) -> Void

Write raw bytes to a file.

pub def write_bytes_atomic(file_path: String, data: List[Int]) -> Void

Write raw bytes to a file atomically.

pub def create_dir(dir_path: String) -> Void

Create a directory.

pub def ensure_dir(dir_path: String) -> Void

Create a directory and any missing parent directories.

pub def ensure_parent(file_path: String) -> Void

Create any missing parent directories for a file path.

pub def mkdir_p(dir_path: String) -> Void

Alias for ensure_dir().

pub def remove(file_path: String) -> Void

Remove a file or directory.

pub def exists(file_path: String) -> Bool

Return true when a path exists.

pub def is_symlink(file_path: String) -> Bool

Return true when the path is a symbolic link.

pub def read_symlink(file_path: String) -> String

Return the target path stored in a symbolic link.

pub def create_file_symlink(target_path: String, link_path: String) -> Void

Create a symbolic link that points at a file target.

pub def create_dir_symlink(target_path: String, link_path: String) -> Void

Create a symbolic link that points at a directory target.

pub def read_dir(dir_path: String) -> List[String]

List all entries in a directory.

pub def walk(dir_path: String) -> List[String]

Recursively walk a directory and return full entry paths.

pub def glob(pattern: String) -> List[String]

Return filesystem entries that match a glob pattern.

pub def copy(source_path: String, target_path: String) -> Void

Copy a file to a new location.

pub def rename(source_path: String, target_path: String) -> Void

Rename or move a file or directory.

pub def metadata(file_path: String) -> FileMetadata

Get metadata information for a file or directory.

pub def stat(file_path: String) -> FileMetadata

Alias for metadata().

pub def read_lines(file_path: String) -> List[String]

Read a text file and split it into lines.

pub def write_lines(file_path: String, lines: List[String]) -> Void

Write a list of lines to a file, joining them with "\n".

pub def append_bytes(file_path: String, data: List[Int]) -> Void

Append raw bytes to a file, creating it when it does not exist.

pub def append_file(file_path: String, content: String) -> Void

Append text to a file, creating it when it does not exist.

pub def create_temp_dir(prefix: String) -> String

Create a unique temporary directory and return its path.

pub def create_temp_file(prefix: String) -> String

Create a unique temporary file and return its path.