Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val isAndroid: Boolean
Link copied to clipboard
abstract val isBrowser: Boolean
Link copied to clipboard
abstract val isJvm: Boolean
Link copied to clipboard
abstract val isNative: Boolean
Link copied to clipboard
abstract val isNode: Boolean

Inherited properties

Link copied to clipboard

The delimiter of segments in a path. For example in Linux: /home/user/documents or Windows: C:\Program Files\Notepad.EXE

Functions

Link copied to clipboard
abstract fun osInfo(): OperatingSystem

Get the operating system info

Inherited functions

Link copied to clipboard
open fun atomicMove(source: String, destination: String, mustExist: Boolean = true, overwrite: Boolean = false)

Atomically move a file from source to destination.

Link copied to clipboard
open fun createDir(path: String, mustCreate: Boolean = false)

Create a directory (and any missing parent directories) at path.

Link copied to clipboard
open fun delete(path: String, mustExist: Boolean = true)

Delete a file at path.

Link copied to clipboard
open fun exists(path: String): Boolean

Check if a file or directory exists at path.

Link copied to clipboard
abstract fun fileExists(path: String): Boolean

Check if a file exists at the path.

Link copied to clipboard
abstract fun getAllEnvVars(): Map<String, String>

Get a map of all environment variables.

Link copied to clipboard
abstract fun getAllProperties(): Map<String, String>

Get a map of all JVM system properties.

Link copied to clipboard
abstract fun getenv(key: String): String?

Get an environment variable or null

Link copied to clipboard
abstract fun getProperty(key: String): String?

Get a system property (on supported platforms)

Link copied to clipboard
open fun list(path: String, mustExist: Boolean = true): Collection<String>

List the names of files and directories within the directory at path.

Link copied to clipboard
open fun read(path: String, amount: Long = 0, offset: Long = 0, readAll: Boolean = false): ByteArray

Read bytes from a file at path.

Link copied to clipboard
abstract suspend fun readFileOrNull(path: String): ByteArray?

Read the contents of a file as a String or return null on any error.

Link copied to clipboard
open fun readOrNull(path: String, amount: Long = 0, offset: Long = 0, readAll: Boolean = false, mustExist: Boolean = true): ByteArray?

Read bytes from a file at path, returning null if the file does not exist and mustExist is false.

Link copied to clipboard
open fun size(path: String, mustExist: Boolean = true): Long

Get the size of a file at path in bytes.

Link copied to clipboard
abstract fun write(path: String, data: ByteArray, writeType: WriteType, mustExist: Boolean = false, permissions: String? = null)

Write data to a file at path using the specified writeType strategy.

Link copied to clipboard
abstract suspend fun writeFile(path: String, data: ByteArray)

Write the contents of a file. File will be created if it doesn't exist. Existing files will be overwritten.