Skip to content

File.ReadAllBytes

method · File · cAlgo.API Since 5.7

DesktopCLICloud

Reads the contents of the file into a byte array.

Environment behaviour

Cloud — not supported. Exists returns false; reads return empty string/array; writes and appends silently do nothing. No exception.

Definition

byte[] ReadAllBytes()
file.ReadAllBytes() -> list[int]

Returns byte[] — byte[]

Examples

protected override void OnStart()
{
    var bytes = DataFile.ReadAllBytes();
    Print("Read {0} bytes from {1}", bytes.Length, DataFile.Name);
}
data = api.DataFile.ReadAllBytes()
api.Print(f"Read {data.Length} bytes from {api.DataFile.Name}")
{
  "Parameters": [
    {
      "Name": "DataFile",
      "DisplayName": "Data File",
      "Type": "File"
    }
  ]
}