Skip to main content
Build Real-time Applications with the new "watch" API in Deno KV
Read more
function Deno.readDir
allow-read

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 | URL

Returns

AsyncIterable<DirEntry>