Class Dir

A class representing a directory stream.

Implements

  • Dir

Constructors

Properties

_entries?: Dirent[]
closed: boolean = false
path: string

Methods

  • Asynchronously iterates over the directory via readdir(3) until all entries have been read.

    Returns AsyncIterableIterator<Dirent>

  • Asynchronously close the directory's underlying resource handle. Subsequent reads will result in errors.

    Returns Promise<void>

  • Asynchronously close the directory's underlying resource handle. Subsequent reads will result in errors.

    A promise is returned that will be fulfilled after the resource has been closed.

    Parameters

    Returns void

    v12.12.0

  • Synchronously close the directory's underlying resource handle. Subsequent reads will result in errors.

    Returns void

  • Asynchronously read the next directory entry via readdir(3) as an Dirent. After the read is completed, a value is returned that will be resolved with an Dirent, or null if there are no more directory entries to read. Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms.

    Returns Promise<null | Dirent>

  • Asynchronously read the next directory entry via readdir(3) as an fs.Dirent.

    A promise is returned that will be fulfilled with an fs.Dirent, or null if there are no more directory entries to read.

    Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms. Entries added or removed while iterating over the directory might not be included in the iteration results.

    Parameters

    Returns void

    containing {fs.Dirent|null}

    v12.12.0

  • Synchronously read the next directory entry via readdir(3) as a Dirent. If there are no more directory entries to read, null will be returned. Directory entries returned by this function are in no particular order as provided by the operating system's underlying directory mechanisms.

    Returns null | Dirent