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

x/deno/cli/js/lib.deno.ns.d.ts>Deno.readDir

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

Reads the directory given by path and returns an async iterable of Deno.DirEntry.

  for await (const dirEntry of Deno.readDir("/")) {
    console.log(dirEntry.name);
  }

Throws error if path is not a directory.

Requires allow-read permission.

Parameters

path: string

Returns

AsyncIterable<DirEntry>