Deno.readdir
readdir
-
readdir(path: string): AsyncIterable<DirEntry>
-
读取
path
文件目录,并返回Deno.DirEntry
迭代器。Reads the directory given by
path
and returns an async iterable ofDeno.DirEntry
.for await (const dirEntry of Deno.readdir("/")) {
console.log(dirEntry.name);
}
如果
path
不是目录则抛出错误。Throws error if
path
is not a directory.Requires
allow-read
permission.
参数
- ##### path: string