Package-level declarations

Basic API for working with files.

Thread-safety guarantees

Until stated otherwise, types and functions provided by the library are not thread safe.

Known issues

Basic API for working with files.

Thread-safety guarantees

Until stated otherwise, types and functions provided by the library are not thread safe.

Known issues

Basic API for working with files.

Thread-safety guarantees

Until stated otherwise, types and functions provided by the library are not thread safe.

Known issues

Basic API for working with files.

Thread-safety guarantees

Until stated otherwise, types and functions provided by the library are not thread safe.

Known issues

Basic API for working with files.

Thread-safety guarantees

Until stated otherwise, types and functions provided by the library are not thread safe.

Known issues

Basic API for working with files.

Thread-safety guarantees

Until stated otherwise, types and functions provided by the library are not thread safe.

Known issues

Basic API for working with files.

Thread-safety guarantees

Until stated otherwise, types and functions provided by the library are not thread safe.

Known issues

  • #312 For wasmWasi target, directory listing (kotlinx.io.files.FileSystem.list) does not work with NodeJS runtime on Windows, as fd_readdir function is not implemented there.

Types

Link copied to clipboard
class FileMetadata(val isRegularFile: Boolean = false, val isDirectory: Boolean = false, val size: Long = 0)

Represents information about a file or directory obtainable from a filesystem like a type of filesystem node (is it a directory or a file?), its size, and so on.

Link copied to clipboard
expect class FileNotFoundException(message: String?) : IOException

Signals an I/O operation's failure due to a missing file or directory.

actual open class FileNotFoundException(message: String?) : IOException
actual open class FileNotFoundException(message: String?) : IOException
actual open class FileNotFoundException(message: String?) : IOException
Link copied to clipboard
sealed interface FileSystem

An interface providing basic operations on a filesystem, such as reading and writing files, creating directories, gathering file metadata and so on.

Link copied to clipboard
expect class Path

A wrapper around a string representing a file path allowing to read from and write to a corresponding file using Sink and Source.

actual class Path
actual class Path
actual class Path
actual class Path

Properties

Link copied to clipboard

An instance of FileSystem representing a default system-wide filesystem.

An instance of FileSystem representing a default system-wide filesystem.

Link copied to clipboard

A platform-specific character separating parts of the path. It's inherited from the default system's filesystem. It should not be used if an application is working with multiple filesystems having different separators.

Link copied to clipboard

Path to a directory suitable for creating temporary files.

Path to a directory suitable for creating temporary files.

Functions

Link copied to clipboard
expect fun Path(path: String): Path

Returns Path for the given string without much of a validation.

fun Path(base: String, vararg parts: String): Path
fun Path(base: Path, vararg parts: String): Path

Returns Path for the given base path concatenated with parts using SystemPathSeparator.

actual fun Path(path: String): Path
actual fun Path(path: String): Path
actual fun Path(path: String): Path
actual fun Path(path: String): Path
Link copied to clipboard
@JvmName(name = "sinkDeprecated")
fun Path.sink(): Sink

Returns RawSink for the given path, creates file if it doesn't exist, throws if it's a directory, overwrites contents.

Link copied to clipboard
@JvmName(name = "sourceDeprecated")
fun Path.source(): Source

Returns RawSource for the given file or throws if path is not a file or does not exist