appendText
val filesDir = _files.getFilesDir()
val file = _files.buildFile {
setPath(filesDir, "tmp/aaa.txt")
}
file.writeText("hello world", "UTF-8")
file.appendText("hi world", "UTF-8")
_console.log(file.readText("UTF-8"))
file.delete()
def filesDir = $files.getFilesDir()
def file = $files.buildFile {
setPath(filesDir, "tmp/aaa.txt")
}
file.writeText("hello world", "UTF-8")
file.appendText("hi world", "UTF-8")
$console.log(file.readText("UTF-8"))
file.delete()
let filesDir = $files.getFilesDir()
let file = $files.buildFile((fileBuilder) => {
fileBuilder.setPath(filesDir, "tmp/aaa.txt")
})
file.writeText("hello world", "UTF-8")
file.appendText("hi world", "UTF-8")
$console.log(file.readText("UTF-8"))
file.delete()
local filesDir = _files:getFilesDir()
local file = _files:buildFile(function(fileBuilder)
fileBuilder:setPath(filesDir, "tmp/aaa.txt")
end)
file:writeText("hello world", "UTF-8")
file:appendText("hi world", "UTF-8")
_console:log(file:readText("UTF-8"))
file:delete()
<?php
$filesDir = $files->getFilesDir();
$file = $files->buildFile(function ($fileBuilder) use ($filesDir) {
$fileBuilder->setPath($filesDir, "tmp/aaa.txt");
});
$file->writeText("hello world", "UTF-8");
$file->appendText("hi world", "UTF-8");
$console->log($file->readText("UTF-8"));
$file->delete();
filesDir = _files.getFilesDir()
def fn1(fileBuilder):
fileBuilder.setPath(filesDir, "tmp/aaa.txt")
file = _files.buildFile(fn1)
file.writeText("hello world", "UTF-8")
file.appendText("hi world", "UTF-8")
_console.log(file.readText("UTF-8"))
file.delete()
filesDir = $files.getFilesDir()
file = $files.buildFile { |fileBuilder|
fileBuilder.setPath(filesDir, "tmp/aaa.txt")
}
file.writeText("hello world", "UTF-8")
file.appendText("hi world", "UTF-8")
$console.log(file.readText("UTF-8"))
file.delete()
Last modified: 29 April 2025