IO Module Documentation
The io
module provides functions for reading from and writing to files.
Functions
-
readfile(path)
: Reads the contents of the file specified by thepath
parameter and returns it as a string. -
writefile(path, content[, mode])
: Writes thecontent
to the file specified by thepath
parameter. The optionalmode
parameter specifies the file mode (permission and mode bits). If not provided, the default mode is0644
.
Example Usage
import "io"
// Read contents of a file
content := io.readfile("/path/to/file.txt")
// Write contents to a file
io.writefile("/path/to/file.txt", "Hello, World!")