API Reference › File › File.read
method

File.read

File.read(file: f, buffer: b, count: n) -> int

Reads at most count bytes from the handle into buffer (a bytes allocation) and returns how many arrived; fewer than asked means the end of the file.

Example

# doc-check: skip — illustrative
let buf = bytes(size + 1)
let got = File.read(file: f, buffer: buf, count: size)
← All symbols