package
0.0.0-20250120080617-bb7c638c6f78
Repository: https://github.com/chainreactors/mals.git
Documentation: pkg.go.dev
# README
ioutil 
Usage
local ioutil = require("ioutil")
-- ioutil.write_file()
local err = ioutil.write_file("./test/file.data", "content of test file")
if err then error(err) end
-- ioutil.read_file()
local result, err = ioutil.read_file("./test/file.data")
if err then error(err) end
if not(result == "content of test file") then error("ioutil.read_file()") end
-- ioutil.copy()
local input_fh, err = io.open("./test/file.test", "r")
assert(not err, err)
local output_fh, err = io.open("./test/file2.data", "w")
assert(not err, err)
err = ioutil.copy(output_fh, input_fh)
assert(not err, err)
input_fh:close()
output_fh:close()
# Functions
No description provided by the author
No description provided by the author
Loader is the module loader function.
Preload adds ioutil to the given Lua state's package.preload table.
ReadFile lua ioutil.read_file(filepath) reads the file named by filename and returns the contents, returns (string,error).
WriteFile lua ioutil.write_file(filepath, data) reads the file named by filename and returns the contents, returns (string,error).