Skip to content

File I/O

You can read the entire content of a file into a string.

str content = read_file("test.txt");
print(content);

You can write content to a file. This will overwrite the existing content.

write_file("test.txt", "Hello Tulpar!");

You can append content to the end of a file.

append_file("test.txt", "\nNew line");

You can check if a file exists.

bool exists = file_exists("test.txt");
if (exists) {
print("File found!");
}