◐ Shell
clean mode source ↗

typings: add `fs_dir` types · nodejs/node@2d8490f

1+

import {InternalFSBinding, ReadFileContext} from './fs';

2+3+

declare namespace InternalFSDirBinding {

4+

import FSReqCallback = InternalFSBinding.FSReqCallback;

5+

type Buffer = Uint8Array;

6+

type StringOrBuffer = string | Buffer;

7+8+

class DirHandle {

9+

read(encoding: string, bufferSize: number, _: unknown, ctx: ReadFileContext): string[] | undefined;

10+

close(_: unknown, ctx: ReadFileContext): void;

11+

}

12+13+

function opendir(path: StringOrBuffer, encoding: string, req: FSReqCallback): DirHandle;

14+

function opendir(path: StringOrBuffer, encoding: string, _: undefined, ctx: ReadFileContext): DirHandle;

15+

function opendirSync(path: StringOrBuffer): DirHandle;

16+

}

17+18+

export interface FsDirBinding {

19+

opendir: typeof InternalFSDirBinding.opendir;

20+

opendirSync: typeof InternalFSDirBinding.opendirSync;

21+

}