类:fs.Dirent
【Class: fs.Dirent】
目录项的表示,可以是目录中的文件或子目录,由从 <fs.Dir> 读取时返回。目录项是文件名和文件类型的组合。
【A representation of a directory entry, which can be a file or a subdirectory within the directory, as returned by reading from an <fs.Dir>. The directory entry is a combination of the file name and file type pairs.】
此外,当调用 fs.readdir() 或 fs.readdirSync() 并将 withFileTypes 选项设置为 true 时,返回的数组将填充 <fs.Dirent> 对象,而不是字符串或 <Buffer>。
【Additionally, when fs.readdir() or fs.readdirSync() is called with
the withFileTypes option set to true, the resulting array is filled with
<fs.Dirent> objects, rather than strings or <Buffer>s.】