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

x/xdg/vendor/types/deno.d.ts>Deno.readDirSync

Determine XDG Base Directory paths (OS/platform portable)
Go to Latest
function Deno.readDirSync
import { Deno } from "https://deno.land/x/xdg@v10.5.1/vendor/types/deno.d.ts";
const { readDirSync } = Deno;

Synchronously reads the directory given by path and returns an iterable of Deno.DirEntry.

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

Throws error if path is not a directory.

Requires allow-read permission.

Parameters

path: string | URL

Returns

Iterable<DirEntry>