toWriteChannel

abstract fun toWriteChannel(scriptFile: ScriptFile, coroutineContext: CoroutineContext.() -> Unit?): ByteWriteChannel

将一个 ScriptFile 转换为可供异步写入的 ByteWriteChannel.

这对于在协程中进行非阻塞的文件写入非常有用. 如果文件已存在, 其内容将被覆盖.

Return

一个可用于异步写入文件内容的 ByteWriteChannel.

Parameters

scriptFile

需要写入的目标文件.

coroutineContext

(可选) 用于配置协程上下文的 lambda 表达式.