Select

Represents an interface for handling file and directory operations within a filesystem context. Extends the Serialization interface to support path serialization and deserialization.

Parameters

Path

The type representing the file or directory path.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun exists(path: Path): Boolean

Checks if a given path exists in the file system.

Link copied to clipboard
abstract suspend fun extension(path: Path): String

Retrieves the file extension from the specified path.

Link copied to clipboard
abstract fun fromAbsoluteString(path: String): Path

Converts a string representation of an absolute file path into a Path object.

Link copied to clipboard
abstract fun fromRelativeString(base: Path, path: String): Path

Converts a relative path string to a Path object by resolving it against a base path.

Link copied to clipboard
abstract suspend fun list(path: Path): List<Path>

Lists all the paths under a specified directory or file path.

Link copied to clipboard
abstract suspend fun metadata(path: Path): FileMetadata?

Retrieves the metadata associated with the specified file or directory.

Link copied to clipboard
abstract suspend fun name(path: Path): String

Retrieves the name of the file or directory represented by the given path.

Link copied to clipboard
abstract suspend fun parent(path: Path): Path?

Retrieves the parent directory/path of the given path.

Link copied to clipboard
open suspend fun relative(root: Path, path: Path): String?

Computes the relative path from a given root path to the specified path.

Link copied to clipboard
abstract suspend fun relativize(root: Path, path: Path): String?

Relativizes the given path path based on the specified root path. This function calculates the relative path from the root to the path.

Link copied to clipboard
abstract fun toAbsolutePathString(path: Path): String

Converts a given Path object into its absolute path representation as a string.

Link copied to clipboard
abstract fun toPathString(path: Path): String

Converts the given path to a string representation of the file path.