file library

This commit is contained in:
2025-10-04 14:54:32 +10:00
parent 9e87805a6f
commit b3950dcd62
7 changed files with 145 additions and 3 deletions

View File

@@ -179,4 +179,40 @@ fun myFunc {
let result = (myFunc)
println $result # Prints "doing stuff..." and then "done"
```
```
## File I/O
### file
The `file` module contains many submodules for reading from and writing to files.
#### file read
Reads an entire file. Returns a string.
Example: `file read "myFile.txt"`
#### file readlines
Reads an entire file. Returns a list of strings, split by the line.
Example: `file readlines "myFile.txt"`
#### file exists
Determines whether or not a file exists on the system. If yes, returns "true". If not, returns "false".
Example: `file exists "myFile.txt"`
#### file write
Overwrites a file with content provided. This is destructive, be careful!
Example: `file write "myFile.txt" "Hello from the file!"`
#### file append
Appends text to the end of a file.
Example: `file append "myFile.txt" "Hello from the end of the file!"`