readBytes


Description:

public static uint8[]? readBytes (Path path)

Reads the entire contents of a file as a byte array.

Example:

    var path = new Path ("/tmp/data.bin");
uint8[]? data = Files.readBytes (path);
if (data != null) {
print ("Read %d bytes\n", data.length);
}

Parameters:

path

path to the file.

Returns:

the file contents as a byte array, or null on error.