You are on page 1of 3

callback: (err: NodeJS.

ErrnoException | null, files: string[] | Buffer[])


=> void,
): void;

/**
* Asynchronous readdir(3) - read a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:`
protocol.
*/
function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null,
files: string[]) => void): void;

/**
* Asynchronous readdir(3) - read a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:`
protocol.
* @param options If called with `withFileTypes: true` the result data will be
an array of Dirent.
*/
function readdir(path: PathLike, options: { encoding?: string | null;
withFileTypes: true }, callback: (err: NodeJS.ErrnoException | null, files:
Dirent[]) => void): void;

// NOTE: This namespace provides design-time support for util.promisify.


Exported members do not exist at runtime.
namespace readdir {
/**
* Asynchronous readdir(3) - read a directory.
* @param path A path to a file. If a URL is provided, it must use the
`file:` protocol.
* @param options The encoding (or an object specifying the encoding), used
as the encoding of the result. If not provided, `'utf8'` is used.
*/
function __promisify__(path: PathLike, options?: { encoding: BufferEncoding
| null; withFileTypes?: false } | BufferEncoding | null): Promise<string[]>;

/**
* Asynchronous readdir(3) - read a directory.
* @param path A path to a file. If a URL is provided, it must use the
`file:` protocol.
* @param options The encoding (or an object specifying the encoding), used
as the encoding of the result. If not provided, `'utf8'` is used.
*/
function __promisify__(path: PathLike, options: "buffer" | { encoding:
"buffer"; withFileTypes?: false }): Promise<Buffer[]>;

/**
* Asynchronous readdir(3) - read a directory.
* @param path A path to a file. If a URL is provided, it must use the
`file:` protocol.
* @param options The encoding (or an object specifying the encoding), used
as the encoding of the result. If not provided, `'utf8'` is used.
*/
function __promisify__(path: PathLike, options?: { encoding?: string |
null; withFileTypes?: false } | string | null): Promise<string[] | Buffer[]>;

/**
* Asynchronous readdir(3) - read a directory.
* @param path A path to a file. If a URL is provided, it must use the
`file:` protocol.
* @param options If called with `withFileTypes: true` the result data will
be an array of Dirent
*/
function __promisify__(path: PathLike, options: { encoding?: string | null;
withFileTypes: true }): Promise<Dirent[]>;
}

/**
* Synchronous readdir(3) - read a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:`
protocol.
* @param options The encoding (or an object specifying the encoding), used as
the encoding of the result. If not provided, `'utf8'` is used.
*/
function readdirSync(path: PathLike, options?: { encoding: BufferEncoding |
null; withFileTypes?: false } | BufferEncoding | null): string[];

/**
* Synchronous readdir(3) - read a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:`
protocol.
* @param options The encoding (or an object specifying the encoding), used as
the encoding of the result. If not provided, `'utf8'` is used.
*/
function readdirSync(path: PathLike, options: { encoding: "buffer";
withFileTypes?: false } | "buffer"): Buffer[];

/**
* Synchronous readdir(3) - read a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:`
protocol.
* @param options The encoding (or an object specifying the encoding), used as
the encoding of the result. If not provided, `'utf8'` is used.
*/
function readdirSync(path: PathLike, options?: { encoding?: string | null;
withFileTypes?: false } | string | null): string[] | Buffer[];

/**
* Synchronous readdir(3) - read a directory.
* @param path A path to a file. If a URL is provided, it must use the `file:`
protocol.
* @param options If called with `withFileTypes: true` the result data will be
an array of Dirent.
*/
function readdirSync(path: PathLike, options: { encoding?: string | null;
withFileTypes: true }): Dirent[];

/**
* Asynchronous close(2) - close a file descriptor.
* @param fd A file descriptor.
*/
function close(fd: number, callback: NoParamCallback): void;

// NOTE: This namespace provides design-time support for util.promisify.


Exported members do not exist at runtime.
namespace close {
/**
* Asynchronous close(2) - close a file descriptor.
* @param fd A file descriptor.

You might also like