fs.opendirSync(path[, options])


  • path <string> | <Buffer> | <URL>

  • options <Object>

    • encoding <string> | <null> 默认值:'utf8'

      ¥encoding <string> | <null> Default: 'utf8'

    • bufferSize <number> 当从目录读取时,在内部缓冲的目录条目数。值越大,性能越好,但内存使用率越高。默认值:32

      ¥bufferSize <number> Number of directory entries that are buffered internally when reading from the directory. Higher values lead to better performance but higher memory usage. Default: 32

  • 返回:<fs.Dir>

    ¥Returns: <fs.Dir>

同步地打开目录。请参阅 opendir(3)

¥Synchronously open a directory. See opendir(3).

创建 <fs.Dir>,其中包含用于从目录读取和清理目录的所有进一步的函数。

¥Creates an <fs.Dir>, which contains all further functions for reading from and cleaning up the directory.

encoding 选项设置在打开目录和随后的读取操作时 path 的编码。

¥The encoding option sets the encoding for the path while opening the directory and subsequent read operations.