write

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.

Parameters

path

fully qualified path encoded specifically to the target platform's filesystem

data

the bytes to write

writeType

the write strategy: WriteType.OVERWRITE to replace file contents, WriteType.APPEND to add to the end, or WriteType.OFFSET to write at a specific byte position

mustExist

if true, throws aws.smithy.kotlin.runtime.io.IOException when the file does not exist

permissions

optional POSIX file permissions as an octal string to apply when the file is created (e.g., "600" for owner read/write only). Ignored if the file already exists or the platform does not support POSIX permissions (e.g., Windows).