Add file.read_binary for consistency

This commit is contained in:
Lars Mueller 2022-07-10 14:31:45 +02:00
parent 6d87228f4f
commit 93c1338135

@ -32,6 +32,14 @@ function read(filename)
return content return content
end end
function read_binary(filename)
local file, err = io.open(filename, "rb")
if file == nil then return nil, err end
local content = file:read"*a"
file:close()
return content
end
function write_unsafe(filename, new_content) function write_unsafe(filename, new_content)
local file, err = io.open(filename, "w") local file, err = io.open(filename, "w")
if file == nil then return false, err end if file == nil then return false, err end