Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/msgpack_rpc/deps.ts>io.readRangeSync

🦕 Deno module to support msgpack-rpc
Go to Latest
function io.readRangeSync
import { io } from "https://deno.land/x/msgpack_rpc@v3.1.6/deps.ts";
const { readRangeSync } = io;

Read a range of bytes synchronously 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 "../testing/asserts.ts";
import { readRangeSync } from "./util.ts";

// Read the first 10 bytes of a file
const file = Deno.openSync("example.txt", { read: true });
const bytes = readRangeSync(file, { start: 0, end: 9 });
assertEquals(bytes.length, 10);

Returns

Uint8Array