Module fs
Utility functions for operations on a file system.
Note: This module is not part of public API!
Functions
read_file (filename, mode) | Reads the specified file and returns its content as string. |
write_file (filename, data, mode) | Writes the given data to the specified file. |
Functions
- read_file (filename, mode)
-
Reads the specified file and returns its content as string.
Parameters:
- filename string Path of the file to read.
- mode string The mode in which to open the file, see io.open (default: "r").
Returns:
-
string
A content of the file.
Or
- nil
- string An error message.
- write_file (filename, data, mode)
-
Writes the given data to the specified file.
Parameters:
- filename string Path of the file to write.
- data string The data to write.
- mode optional string The mode in which to open the file, see io.open (default: "w").
Returns:
-
true
Or
- nil
- string An error message.