@serveryyswys/node.operit 0.0.0-stage → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BUILTINS.json +383 -0
- package/DESIGN.md +513 -0
- package/LICENSE +201 -0
- package/NOTICE +17 -0
- package/README.md +311 -2
- package/dist/assert/strict.d.ts +2 -0
- package/dist/assert/strict.js +7 -0
- package/dist/assert.d.ts +3 -0
- package/dist/assert.js +483 -0
- package/dist/buffer.d.ts +60 -0
- package/dist/buffer.js +524 -0
- package/dist/child_process.d.ts +56 -0
- package/dist/child_process.js +371 -0
- package/dist/console.d.ts +60 -0
- package/dist/console.js +193 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +19 -0
- package/dist/crypto.d.ts +76 -0
- package/dist/crypto.js +312 -0
- package/dist/diagnostics_channel.d.ts +36 -0
- package/dist/diagnostics_channel.js +76 -0
- package/dist/dns/promises.d.ts +34 -0
- package/dist/dns/promises.js +190 -0
- package/dist/dns.d.ts +88 -0
- package/dist/dns.js +259 -0
- package/dist/events.d.ts +40 -0
- package/dist/events.js +237 -0
- package/dist/fs/promises.d.ts +160 -0
- package/dist/fs/promises.js +130 -0
- package/dist/fs.d.ts +221 -0
- package/dist/fs.js +944 -0
- package/dist/http.d.ts +92 -0
- package/dist/http.js +319 -0
- package/dist/https.d.ts +296 -0
- package/dist/https.js +50 -0
- package/dist/index.d.ts +2821 -0
- package/dist/index.js +93 -0
- package/dist/lib/bridge.d.ts +60 -0
- package/dist/lib/bridge.js +207 -0
- package/dist/lib/bytes.d.ts +20 -0
- package/dist/lib/bytes.js +239 -0
- package/dist/lib/child-process-types.d.ts +45 -0
- package/dist/lib/child-process-types.js +2 -0
- package/dist/lib/console-types.d.ts +12 -0
- package/dist/lib/console-types.js +2 -0
- package/dist/lib/cwd.d.ts +2 -0
- package/dist/lib/cwd.js +32 -0
- package/dist/lib/deep-equal.d.ts +3 -0
- package/dist/lib/deep-equal.js +223 -0
- package/dist/lib/deflate.d.ts +2 -0
- package/dist/lib/deflate.js +234 -0
- package/dist/lib/diagnostics-channel-types.d.ts +7 -0
- package/dist/lib/diagnostics-channel-types.js +2 -0
- package/dist/lib/dns-driver.d.ts +14 -0
- package/dist/lib/dns-driver.js +85 -0
- package/dist/lib/dns-types.d.ts +22 -0
- package/dist/lib/dns-types.js +2 -0
- package/dist/lib/errors.d.ts +48 -0
- package/dist/lib/errors.js +424 -0
- package/dist/lib/fs-driver.d.ts +70 -0
- package/dist/lib/fs-driver.js +364 -0
- package/dist/lib/fs-env.d.ts +30 -0
- package/dist/lib/fs-env.js +157 -0
- package/dist/lib/fs-types.d.ts +19 -0
- package/dist/lib/fs-types.js +2 -0
- package/dist/lib/hashes.d.ts +27 -0
- package/dist/lib/hashes.js +432 -0
- package/dist/lib/http-driver.d.ts +30 -0
- package/dist/lib/http-driver.js +72 -0
- package/dist/lib/http-types.d.ts +18 -0
- package/dist/lib/http-types.js +2 -0
- package/dist/lib/inflate.d.ts +6 -0
- package/dist/lib/inflate.js +284 -0
- package/dist/lib/path-types.d.ts +37 -0
- package/dist/lib/path-types.js +2 -0
- package/dist/lib/paths.d.ts +8 -0
- package/dist/lib/paths.js +106 -0
- package/dist/lib/perf-hooks-types.d.ts +18 -0
- package/dist/lib/perf-hooks-types.js +2 -0
- package/dist/lib/process-driver.d.ts +31 -0
- package/dist/lib/process-driver.js +102 -0
- package/dist/lib/punycode.d.ts +8 -0
- package/dist/lib/punycode.js +179 -0
- package/dist/lib/stream-consumers-types.d.ts +4 -0
- package/dist/lib/stream-consumers-types.js +2 -0
- package/dist/lib/stream-types.d.ts +29 -0
- package/dist/lib/stream-types.js +2 -0
- package/dist/lib/timers-types.d.ts +18 -0
- package/dist/lib/timers-types.js +2 -0
- package/dist/lib/url-search-params.d.ts +26 -0
- package/dist/lib/url-search-params.js +281 -0
- package/dist/lib/url-types.d.ts +44 -0
- package/dist/lib/url-types.js +2 -0
- package/dist/lib/url-whatwg.d.ts +78 -0
- package/dist/lib/url-whatwg.js +857 -0
- package/dist/lib/util-types.d.ts +13 -0
- package/dist/lib/util-types.js +2 -0
- package/dist/lib/v8-types.d.ts +30 -0
- package/dist/lib/v8-types.js +2 -0
- package/dist/lib/zlib-types.d.ts +12 -0
- package/dist/lib/zlib-types.js +2 -0
- package/dist/module.d.ts +8 -0
- package/dist/module.js +102 -0
- package/dist/os.d.ts +80 -0
- package/dist/os.js +247 -0
- package/dist/path/posix.d.ts +2 -0
- package/dist/path/posix.js +7 -0
- package/dist/path/win32.d.ts +2 -0
- package/dist/path/win32.js +10 -0
- package/dist/path.d.ts +3 -0
- package/dist/path.js +1222 -0
- package/dist/perf_hooks.d.ts +36 -0
- package/dist/perf_hooks.js +144 -0
- package/dist/process.d.ts +69 -0
- package/dist/process.js +230 -0
- package/dist/punycode.d.ts +22 -0
- package/dist/punycode.js +53 -0
- package/dist/querystring.d.ts +15 -0
- package/dist/querystring.js +209 -0
- package/dist/stream/consumers.d.ts +24 -0
- package/dist/stream/consumers.js +75 -0
- package/dist/stream/promises.d.ts +5 -0
- package/dist/stream/promises.js +10 -0
- package/dist/stream.d.ts +84 -0
- package/dist/stream.js +875 -0
- package/dist/string_decoder.d.ts +15 -0
- package/dist/string_decoder.js +237 -0
- package/dist/sys.d.ts +8 -0
- package/dist/sys.js +9 -0
- package/dist/timers/promises.d.ts +19 -0
- package/dist/timers/promises.js +74 -0
- package/dist/timers.d.ts +21 -0
- package/dist/timers.js +41 -0
- package/dist/tty.d.ts +9 -0
- package/dist/tty.js +25 -0
- package/dist/unsupported.d.ts +12 -0
- package/dist/unsupported.js +17 -0
- package/dist/url.d.ts +28 -0
- package/dist/url.js +486 -0
- package/dist/util/types.d.ts +16 -0
- package/dist/util/types.js +9 -0
- package/dist/util.d.ts +63 -0
- package/dist/util.js +527 -0
- package/dist/v8.d.ts +25 -0
- package/dist/v8.js +127 -0
- package/dist/zlib.d.ts +88 -0
- package/dist/zlib.js +371 -0
- package/package.json +31 -4
package/dist/fs.d.ts
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import * as env from './lib/fs-env';
|
|
2
|
+
import { Buffer } from './buffer';
|
|
3
|
+
import streamModule = require('./stream');
|
|
4
|
+
import type { DirectoryEntry, FileStat } from './lib/fs-driver';
|
|
5
|
+
import type { ReadStreamOptions, WriteStreamOptions } from './lib/fs-types';
|
|
6
|
+
type ReadStreamLike = InstanceType<typeof streamModule.Readable>;
|
|
7
|
+
type WriteStreamLike = InstanceType<typeof streamModule.Writable>;
|
|
8
|
+
declare class Stats {
|
|
9
|
+
readonly sizeValue: number;
|
|
10
|
+
readonly modeValue: number;
|
|
11
|
+
readonly atimeMsValue: number;
|
|
12
|
+
readonly mtimeMsValue: number;
|
|
13
|
+
readonly ctimeMsValue: number;
|
|
14
|
+
readonly birthtimeMsValue: number;
|
|
15
|
+
readonly fileLike: boolean;
|
|
16
|
+
readonly directoryLike: boolean;
|
|
17
|
+
readonly linkLike: boolean;
|
|
18
|
+
constructor(raw: FileStat);
|
|
19
|
+
get size(): number;
|
|
20
|
+
get mode(): number;
|
|
21
|
+
get atimeMs(): number;
|
|
22
|
+
get mtimeMs(): number;
|
|
23
|
+
get ctimeMs(): number;
|
|
24
|
+
get birthtimeMs(): number;
|
|
25
|
+
get atime(): Date;
|
|
26
|
+
get mtime(): Date;
|
|
27
|
+
get ctime(): Date;
|
|
28
|
+
get birthtime(): Date;
|
|
29
|
+
isFile(): boolean;
|
|
30
|
+
isDirectory(): boolean;
|
|
31
|
+
isSymbolicLink(): boolean;
|
|
32
|
+
isBlockDevice(): boolean;
|
|
33
|
+
isCharacterDevice(): boolean;
|
|
34
|
+
isFIFO(): boolean;
|
|
35
|
+
isSocket(): boolean;
|
|
36
|
+
}
|
|
37
|
+
declare class Dirent {
|
|
38
|
+
readonly name: string;
|
|
39
|
+
readonly kind: number;
|
|
40
|
+
constructor(entry: DirectoryEntry);
|
|
41
|
+
isFile(): boolean;
|
|
42
|
+
isDirectory(): boolean;
|
|
43
|
+
isSymbolicLink(): boolean;
|
|
44
|
+
isBlockDevice(): boolean;
|
|
45
|
+
isCharacterDevice(): boolean;
|
|
46
|
+
isFIFO(): boolean;
|
|
47
|
+
isSocket(): boolean;
|
|
48
|
+
}
|
|
49
|
+
declare function readFileSync(target: unknown, options?: unknown): string | Buffer;
|
|
50
|
+
declare function writeFileSync(target: unknown, data: unknown, options?: unknown): void;
|
|
51
|
+
declare function appendFileSync(target: unknown, data: unknown, options?: unknown): void;
|
|
52
|
+
declare function existsSync(target: unknown): boolean;
|
|
53
|
+
declare function statSync(target: unknown, options?: unknown): Stats | undefined;
|
|
54
|
+
declare function lstatSync(target: unknown, options?: unknown): Stats | undefined;
|
|
55
|
+
declare function readdirSync(target: unknown, options?: unknown): string[] | Dirent[];
|
|
56
|
+
declare function mkdirSync(target: unknown, options?: unknown): string | undefined;
|
|
57
|
+
declare function rmSync(target: unknown, options?: unknown): void;
|
|
58
|
+
declare function unlinkSync(target: unknown): void;
|
|
59
|
+
declare function rmdirSync(target: unknown, options?: unknown): void;
|
|
60
|
+
declare function renameSync(from: unknown, to: unknown): void;
|
|
61
|
+
declare function copyFileSync(from: unknown, to: unknown): void;
|
|
62
|
+
declare function realpathSync(target: unknown): string;
|
|
63
|
+
declare function readlinkSync(target: unknown): string;
|
|
64
|
+
declare function symlinkSync(target: unknown, linkPath: unknown): void;
|
|
65
|
+
declare function chmodSync(target: unknown, mode: unknown): void;
|
|
66
|
+
declare function truncateSync(target: unknown, length?: unknown): void;
|
|
67
|
+
declare function utimesSync(target: unknown, atime: unknown, mtime: unknown): void;
|
|
68
|
+
declare function accessSync(target: unknown): void;
|
|
69
|
+
declare function mkdtempSync(prefix: unknown): string;
|
|
70
|
+
declare function openSync(target: unknown, flags?: unknown, mode?: unknown): number;
|
|
71
|
+
declare function closeSync(descriptor: unknown): void;
|
|
72
|
+
declare function readSync(descriptor: unknown, buffer: unknown, offset?: unknown, length?: unknown, position?: unknown): number;
|
|
73
|
+
declare function writeSync(descriptor: unknown, data: unknown, a?: unknown, b?: unknown, c?: unknown): number;
|
|
74
|
+
declare function fstatSync(descriptor: unknown, options?: unknown): Stats;
|
|
75
|
+
declare function ftruncateSync(descriptor: unknown, length?: unknown): void;
|
|
76
|
+
declare function fsyncSync(descriptor: unknown): void;
|
|
77
|
+
declare function readFile(...args: unknown[]): void;
|
|
78
|
+
declare function writeFile(...args: unknown[]): void;
|
|
79
|
+
declare function appendFile(...args: unknown[]): void;
|
|
80
|
+
declare function stat(...args: unknown[]): void;
|
|
81
|
+
declare function lstat(...args: unknown[]): void;
|
|
82
|
+
declare function readdir(...args: unknown[]): void;
|
|
83
|
+
declare function mkdir(...args: unknown[]): void;
|
|
84
|
+
declare function rm(...args: unknown[]): void;
|
|
85
|
+
declare function unlink(...args: unknown[]): void;
|
|
86
|
+
declare function rmdir(...args: unknown[]): void;
|
|
87
|
+
declare function rename(...args: unknown[]): void;
|
|
88
|
+
declare function copyFile(...args: unknown[]): void;
|
|
89
|
+
declare function realpath(...args: unknown[]): void;
|
|
90
|
+
declare function access(...args: unknown[]): void;
|
|
91
|
+
declare function mkdtemp(...args: unknown[]): void;
|
|
92
|
+
declare function open(...args: unknown[]): void;
|
|
93
|
+
declare function close(...args: unknown[]): void;
|
|
94
|
+
declare function read(...args: unknown[]): void;
|
|
95
|
+
declare function write(...args: unknown[]): void;
|
|
96
|
+
declare function fstat(...args: unknown[]): void;
|
|
97
|
+
declare function ftruncate(...args: unknown[]): void;
|
|
98
|
+
declare function fsync(...args: unknown[]): void;
|
|
99
|
+
/** Node 的 fs.exists 回调只收一个布尔值,是唯一不带 error 的形态。 */
|
|
100
|
+
declare function exists(target: unknown, callback: unknown): void;
|
|
101
|
+
/**
|
|
102
|
+
* fs.createReadStream。
|
|
103
|
+
*
|
|
104
|
+
* 与 Node 的差异(本库的驱动层没有 fd 概念,因此是"按需整块读 + 切片下发"):
|
|
105
|
+
* - 首次 _read 时把整个文件读进内存,之后按 highWaterMark 切片,
|
|
106
|
+
* 所以内存占用不是流式的;
|
|
107
|
+
* - 'open' 事件仍会发,但参数是 null(没有真实 fd)。
|
|
108
|
+
*/
|
|
109
|
+
declare function createReadStream(target: unknown, options?: ReadStreamOptions): ReadStreamLike;
|
|
110
|
+
/**
|
|
111
|
+
* fs.createWriteStream。
|
|
112
|
+
*
|
|
113
|
+
* 驱动层没有 fd,但写入语义可以保持流式:首次写按 flag 决定是否截断,
|
|
114
|
+
* 之后逐块追加,内存占用与流式一致。
|
|
115
|
+
*/
|
|
116
|
+
declare function createWriteStream(target: unknown, options?: WriteStreamOptions): WriteStreamLike;
|
|
117
|
+
declare const fs: {
|
|
118
|
+
readFileSync: typeof readFileSync;
|
|
119
|
+
writeFileSync: typeof writeFileSync;
|
|
120
|
+
appendFileSync: typeof appendFileSync;
|
|
121
|
+
existsSync: typeof existsSync;
|
|
122
|
+
statSync: typeof statSync;
|
|
123
|
+
lstatSync: typeof lstatSync;
|
|
124
|
+
readdirSync: typeof readdirSync;
|
|
125
|
+
mkdirSync: typeof mkdirSync;
|
|
126
|
+
rmSync: typeof rmSync;
|
|
127
|
+
unlinkSync: typeof unlinkSync;
|
|
128
|
+
rmdirSync: typeof rmdirSync;
|
|
129
|
+
renameSync: typeof renameSync;
|
|
130
|
+
copyFileSync: typeof copyFileSync;
|
|
131
|
+
realpathSync: typeof realpathSync;
|
|
132
|
+
readlinkSync: typeof readlinkSync;
|
|
133
|
+
symlinkSync: typeof symlinkSync;
|
|
134
|
+
chmodSync: typeof chmodSync;
|
|
135
|
+
truncateSync: typeof truncateSync;
|
|
136
|
+
utimesSync: typeof utimesSync;
|
|
137
|
+
accessSync: typeof accessSync;
|
|
138
|
+
mkdtempSync: typeof mkdtempSync;
|
|
139
|
+
openSync: typeof openSync;
|
|
140
|
+
closeSync: typeof closeSync;
|
|
141
|
+
readSync: typeof readSync;
|
|
142
|
+
writeSync: typeof writeSync;
|
|
143
|
+
fstatSync: typeof fstatSync;
|
|
144
|
+
ftruncateSync: typeof ftruncateSync;
|
|
145
|
+
fsyncSync: typeof fsyncSync;
|
|
146
|
+
fdatasyncSync: typeof fsyncSync;
|
|
147
|
+
readFile: typeof readFile;
|
|
148
|
+
writeFile: typeof writeFile;
|
|
149
|
+
appendFile: typeof appendFile;
|
|
150
|
+
stat: typeof stat;
|
|
151
|
+
lstat: typeof lstat;
|
|
152
|
+
readdir: typeof readdir;
|
|
153
|
+
mkdir: typeof mkdir;
|
|
154
|
+
rm: typeof rm;
|
|
155
|
+
unlink: typeof unlink;
|
|
156
|
+
rmdir: typeof rmdir;
|
|
157
|
+
rename: typeof rename;
|
|
158
|
+
copyFile: typeof copyFile;
|
|
159
|
+
realpath: typeof realpath;
|
|
160
|
+
access: typeof access;
|
|
161
|
+
mkdtemp: typeof mkdtemp;
|
|
162
|
+
exists: typeof exists;
|
|
163
|
+
open: typeof open;
|
|
164
|
+
close: typeof close;
|
|
165
|
+
read: typeof read;
|
|
166
|
+
write: typeof write;
|
|
167
|
+
fstat: typeof fstat;
|
|
168
|
+
ftruncate: typeof ftruncate;
|
|
169
|
+
fsync: typeof fsync;
|
|
170
|
+
createReadStream: typeof createReadStream;
|
|
171
|
+
createWriteStream: typeof createWriteStream;
|
|
172
|
+
Stats: typeof Stats;
|
|
173
|
+
Dirent: typeof Dirent;
|
|
174
|
+
constants: {
|
|
175
|
+
F_OK: number;
|
|
176
|
+
R_OK: number;
|
|
177
|
+
W_OK: number;
|
|
178
|
+
X_OK: number;
|
|
179
|
+
COPYFILE_EXCL: number;
|
|
180
|
+
COPYFILE_FICLONE: number;
|
|
181
|
+
COPYFILE_FICLONE_FORCE: number;
|
|
182
|
+
UV_FS_COPYFILE_EXCL: number;
|
|
183
|
+
UV_FS_COPYFILE_FICLONE: number;
|
|
184
|
+
UV_FS_COPYFILE_FICLONE_FORCE: number;
|
|
185
|
+
O_RDONLY: number;
|
|
186
|
+
O_WRONLY: number;
|
|
187
|
+
O_RDWR: number;
|
|
188
|
+
O_CREAT: number;
|
|
189
|
+
O_EXCL: number;
|
|
190
|
+
O_TRUNC: number;
|
|
191
|
+
O_APPEND: number;
|
|
192
|
+
UV_FS_O_FILEMAP: number;
|
|
193
|
+
UV_FS_SYMLINK_DIR: number;
|
|
194
|
+
UV_FS_SYMLINK_JUNCTION: number;
|
|
195
|
+
UV_DIRENT_UNKNOWN: number;
|
|
196
|
+
UV_DIRENT_FILE: number;
|
|
197
|
+
UV_DIRENT_DIR: number;
|
|
198
|
+
UV_DIRENT_LINK: number;
|
|
199
|
+
UV_DIRENT_FIFO: number;
|
|
200
|
+
UV_DIRENT_SOCKET: number;
|
|
201
|
+
UV_DIRENT_CHAR: number;
|
|
202
|
+
UV_DIRENT_BLOCK: number;
|
|
203
|
+
S_IFMT: number;
|
|
204
|
+
S_IFREG: number;
|
|
205
|
+
S_IFDIR: number;
|
|
206
|
+
S_IFCHR: number;
|
|
207
|
+
S_IFIFO: number;
|
|
208
|
+
S_IFLNK: number;
|
|
209
|
+
S_IRUSR: number;
|
|
210
|
+
S_IWUSR: number;
|
|
211
|
+
S_IXUSR: number;
|
|
212
|
+
S_IRGRP: number;
|
|
213
|
+
S_IWGRP: number;
|
|
214
|
+
S_IXGRP: number;
|
|
215
|
+
S_IROTH: number;
|
|
216
|
+
S_IWOTH: number;
|
|
217
|
+
S_IXOTH: number;
|
|
218
|
+
};
|
|
219
|
+
env: typeof env;
|
|
220
|
+
};
|
|
221
|
+
export = fs;
|