Skip to main content
Deno.readDirSync - Deno documentation
function Deno.readDirSync
allow-read
readDirSync(path: string | URL): Iterable<DirEntry>

Synchronously reads the directory given by path and returns an iterable of Deno.DirEntry. The order of entries is not guaranteed.

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

Return Type

Iterable<DirEntry>
Back to top