pub fn read_range(
handle: &DocumentHandle,
offset: u64,
length: u64,
) -> Result<Vec<u8>, Error>Expand description
Up to length bytes of a stored file, starting offset bytes in.
The size is asked for first, so the range is held at what the file has past
offset: one that runs past the end answers with exactly the bytes up to
the end, and one that starts at or past the end is refused before any range
is read. What is left is read as read reads a whole file — in ranges of
at most MAX_RANGE_BYTES, into one buffer allocated once at that length,
each range answered in full or refused.
Asking for the size first is also what makes a host that cannot read stored files refuse in its own words, before any range is asked of it.