Synchronous version of readDir. Reads the contents of a directory.
readDir
Note: Returns DirEntryLike[] instead of AsyncIterableIterator<DirEntry> because:
DirEntryLike[]
AsyncIterableIterator<DirEntry>
FileSystemHandle
DirEntryLike
FileSystemHandleLike
The absolute path of the directory to read.
Optional
Optional read options (e.g., recursive).
An IOResult containing an array of directory entries.
IOResult
readDir for the async version.
1.1.0
readDirSync('/documents') .inspect(entries => entries.forEach(e => console.log(e.path, e.handle.kind))); Copy
readDirSync('/documents') .inspect(entries => entries.forEach(e => console.log(e.path, e.handle.kind)));
Synchronous version of
readDir. Reads the contents of a directory.Note: Returns
DirEntryLike[]instead ofAsyncIterableIterator<DirEntry>because:FileSystemHandleobjects cannot be serialized across threads;DirEntryLikeusesFileSystemHandleLikewhich is JSON-serializable