core :: Path :: read_all_bytes
var content = "/etc/issue".to_path.read_all_bytes
print content.to_s
last_error
is updated to contains the error information on error, and null on success.
In case of error, the result might be empty or truncated.
# Read all the content on the file as a raw sequence of bytes.
#
# ~~~
# var content = "/etc/issue".to_path.read_all_bytes
# print content.to_s
# ~~~
#
# `last_error` is updated to contains the error information on error, and null on success.
# In case of error, the result might be empty or truncated.
fun read_all_bytes: Bytes
do
var s = open_ro
var res = s.read_all_bytes
s.close
last_error = s.last_error
return res
end
lib/core/file.nit:576,2--592,4