Deno.readdirsync
readdirSync
-
readdirSync(path: string): Iterable<DirEntry>
-
同步读取
path
文件目录,并返回Deno.DirEntry
迭代器。Synchronously reads the directory given by
path
and returns an iterable ofDeno.DirEntry
.for (const dirEntry of Deno.readdirSync("/")) { console.log(dirEntry.name); }
如果
path
不是目录则抛出错误。Throws error if
path
is not a directory.需要
allow-read
权限。Requires
allow-read
permission.
参数
- ##### path: string
返回 Iterable<DirEntry>
realpath
-
realpath(path: string): Promise<string>
-
返回被解析后的符号链接绝对路径。
Resolves to the absolute normalized path, with symbolic links resolved.
// e.g. given /home/alice/file.txt and current directory /home/alice await Deno.symlink("file.txt", "symlink_file.txt"); const realPath = await Deno.realpath("./file.txt"); const realSymLinkPath = await Deno.realpath("./symlink_file.txt"); console.log(realPath); // outputs "/home/alice/file.txt" console.log(realSymLinkPath); //outputs "/home/alice/file.txt"
需要
allow-read
权限Requires
allow-read
permission.
参数
- ##### path: string