Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/js/lib.deno_runtime.d.ts>Deno.readFile

A modern runtime for JavaScript and TypeScript.
Go to Latest
function Deno.readFile
import { Deno } from "https://deno.land/x/deno@v0.28.0/cli/js/lib.deno_runtime.d.ts";
const { readFile } = Deno;

Read the entire contents of a file.

  const decoder = new TextDecoder("utf-8");
  const data = await Deno.readFile("hello.txt");
  console.log(decoder.decode(data));

Parameters

filename: string

Returns

Promise<Uint8Array>