function readRange
readRange(r: Reader & Deno.Seeker,range: ByteRange): Promise<Uint8Array>Deprecated
(will be removed after 1.0.0) Use the Web Streams API instead.
Read a range of bytes from a file or other resource that is readable and seekable. The range start and end are inclusive of the bytes within that range.
import { assertEquals } from "@std/assert/assert_equals"; import { readRange } from "@std/io/read_range"; // Read the first 10 bytes of a file const file = await Deno.open("example.txt", { read: true }); const bytes = await readRange(file, { start: 0, end: 9 }); assertEquals(bytes.length, 10);
Parameters
r: Reader & Deno.Seekerrange: ByteRange