18 lines
453 B
Kotlin
18 lines
453 B
Kotlin
package pw.binom.llmproxy
|
|
|
|
import kotlinx.io.Buffer
|
|
import kotlinx.io.files.Path
|
|
import kotlinx.io.files.SystemFileSystem
|
|
import kotlinx.io.readByteArray
|
|
|
|
internal fun readConfigText(path: String): String {
|
|
val src = SystemFileSystem.source(Path(path))
|
|
try {
|
|
val buf = Buffer()
|
|
while (src.readAtMostTo(buf, Long.MAX_VALUE) > 0L) { }
|
|
return buf.readByteArray().decodeToString()
|
|
} finally {
|
|
src.close()
|
|
}
|
|
}
|