Function readdir

  • Asynchronous readdir(3) - read a directory.

    Note: The order of entries is not guaranteed

    Parameters

    • path: PathLike

      A path to a file. If a URL is provided, it must use the file: protocol.

    • Optionaloptions: null | BufferEncoding | ObjectEncodingOptions & ReaddirOptions & {
          withFileTypes?: false;
      }

      The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, 'utf8'.

    Returns Promise<string[]>

  • Parameters

    • path: PathLike
    • options: BufferEncodingOption & ReaddirOptions & {
          withFileTypes?: false;
      }

    Returns Promise<Buffer[]>

  • Parameters

    • path: PathLike
    • Optionaloptions: null | BufferEncoding | ObjectEncodingOptions & ReaddirOptions & {
          withFileTypes?: false;
      }

    Returns Promise<string[] | Buffer[]>

  • Parameters

    • path: PathLike
    • options: ObjectEncodingOptions & ReaddirOptions & {
          withFileTypes: true;
      }

    Returns Promise<Dirent[]>

  • Parameters

    • path: PathLike
    • Optionaloptions: null | BufferEncoding | (ReaddirOptions & (ObjectEncodingOptions | BufferEncodingOption))

    Returns Promise<string[] | Dirent[] | Buffer[]>