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 thepathparameter and returns it as a string. -
writefile(path, content[, mode]): Writes thecontentto the file specified by thepathparameter. The optionalmodeparameter 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!")