Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2d8490f

Browse filesBrowse files
anonrigmarco-ippolito
authored andcommitted
typings: add fs_dir types
PR-URL: #53631 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 662bf52 commit 2d8490f
Copy full SHA for 2d8490f

3 files changed

+36-13Lines changed: 36 additions & 13 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎typings/globals.d.ts‎

Copy file name to clipboardExpand all lines: typings/globals.d.ts
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {ConfigBinding} from "./internalBinding/config";
44
import {ConstantsBinding} from "./internalBinding/constants";
55
import {HttpParserBinding} from "./internalBinding/http_parser";
66
import {FsBinding} from "./internalBinding/fs";
7+
import {FsDirBinding} from "./internalBinding/fs_dir";
78
import {MessagingBinding} from "./internalBinding/messaging";
89
import {OptionsBinding} from "./internalBinding/options";
910
import {OSBinding} from "./internalBinding/os";
@@ -34,6 +35,7 @@ interface InternalBindingMap {
3435
config: ConfigBinding;
3536
constants: ConstantsBinding;
3637
fs: FsBinding;
38+
fs_dir: FsDirBinding;
3739
http_parser: HttpParserBinding;
3840
messaging: MessagingBinding;
3941
options: OptionsBinding;
Collapse file

‎typings/internalBinding/fs.d.ts‎

Copy file name to clipboardExpand all lines: typings/internalBinding/fs.d.ts
+13-13Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
import { ConstantsBinding } from './constants';
22

3+
interface ReadFileContext {
4+
fd: number | undefined;
5+
isUserFd: boolean | undefined;
6+
size: number;
7+
callback: (err?: Error, data?: string | Uint8Array) => unknown;
8+
buffers: Uint8Array[];
9+
buffer: Uint8Array;
10+
pos: number;
11+
encoding: string;
12+
err: Error | null;
13+
signal: unknown /* AbortSignal | undefined */;
14+
}
15+
316
declare namespace InternalFSBinding {
417
class FSReqCallback<ResultType = unknown> {
518
constructor(bigint?: boolean);
619
oncomplete: ((error: Error) => void) | ((error: null, result: ResultType) => void);
720
context: ReadFileContext;
821
}
922

10-
interface ReadFileContext {
11-
fd: number | undefined;
12-
isUserFd: boolean | undefined;
13-
size: number;
14-
callback: (err?: Error, data?: string | Buffer) => unknown;
15-
buffers: Buffer[];
16-
buffer: Buffer;
17-
pos: number;
18-
encoding: string;
19-
err: Error | null;
20-
signal: unknown /* AbortSignal | undefined */;
21-
}
22-
2323
interface FSSyncContext {
2424
fd?: number;
2525
path?: string;
Collapse file
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.