file library
This commit is contained in:
@@ -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!"`
|
||||
|
||||
Reference in New Issue
Block a user