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

x/deno/cli/js/deno.ts>readSync

A modern runtime for JavaScript and TypeScript.
Go to Latest
function readSync
import { readSync } from "https://deno.land/x/deno@v0.30.0/cli/js/deno.ts";

Read synchronously from a file ID into an array buffer.

Return number | EOF for the operation.

 const file = Deno.openSync("/foo/bar.txt");
 const buf = new Uint8Array(100);
 const nread = Deno.readSync(file.rid, buf);
 const text = new TextDecoder().decode(buf);

Parameters

rid: number
p: Uint8Array

Returns

number | EOF