Add file.read_binary for consistency

master
Lars Mueller 2022-07-10 14:31:45 +02:00
parent 6d87228f4f
commit 93c1338135
1 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,14 @@ function read(filename)
return content
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)
local file, err = io.open(filename, "w")
if file == nil then return false, err end