rush-fs 0.0.1

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.
@@ -0,0 +1,420 @@
1
+ # Hyper-FS
2
+
3
+ [English](./README.md) | 中文
4
+
5
+ <p align="center">
6
+ <img src="https://img.shields.io/badge/Written%20in-Rust-orange?style=flat-square" alt="Written in Rust">
7
+ <img src="https://img.shields.io/npm/v/hyper-fs?style=flat-square" alt="NPM Version">
8
+ <img src="https://img.shields.io/npm/l/hyper-fs?style=flat-square" alt="License">
9
+ </p>
10
+
11
+ <p align="center">
12
+ 由 Rust 驱动的高性能 Node.js <code>fs</code> 模块「即插即用」替代品。
13
+ </p>
14
+
15
+ ## 安装
16
+
17
+ ```bash
18
+ npm install hyper-fs
19
+ # or
20
+ pnpm add hyper-fs
21
+ ```
22
+
23
+ ## 状态与路线图
24
+
25
+ 我们正在逐个重写 `fs` 的 API。
26
+
27
+ > **图例**
28
+ >
29
+ > - ✅:完全支持
30
+ > - 🚧:部分支持 / 开发中
31
+ > - ✨:hyper-fs 的新增能力
32
+ > - ❌:暂未支持
33
+
34
+ ### `readdir`
35
+
36
+ - **Node.js 参数**:
37
+ ```ts
38
+ path: string; // ✅
39
+ options?: {
40
+ encoding?: string; // 🚧(默认 'utf8';'buffer' 暂不支持)
41
+ withFileTypes?: boolean; // ✅
42
+ recursive?: boolean; // ✅
43
+ concurrency?: number; // ✨
44
+ };
45
+ ```
46
+ - **返回类型**:
47
+ ```ts
48
+ string[]
49
+ | {
50
+ name: string, // ✅
51
+ parentPath: string, // ✅
52
+ isDir: boolean // ✅
53
+ }[]
54
+ ```
55
+
56
+ ### `readFile`
57
+
58
+ - **Node.js 参数**:
59
+ ```ts
60
+ path: string; // ✅
61
+ options?: {
62
+ encoding?: string; // ✅ (utf8, ascii, latin1, base64, base64url, hex)
63
+ flag?: string; // ✅ (r, r+, w+, a+ 等)
64
+ };
65
+ ```
66
+ - **返回类型**:`string | Buffer`
67
+
68
+ ### `writeFile`
69
+
70
+ - **Node.js 参数**:
71
+ ```ts
72
+ path: string; // ✅
73
+ data: string | Buffer; // ✅
74
+ options?: {
75
+ encoding?: string; // ✅ (utf8, ascii, latin1, base64, base64url, hex)
76
+ mode?: number; // ✅
77
+ flag?: string; // ✅ (w, wx, a, ax)
78
+ };
79
+ ```
80
+
81
+ ### `appendFile`
82
+
83
+ - **Node.js 参数**:
84
+ ```ts
85
+ path: string; // ✅
86
+ data: string | Buffer; // ✅
87
+ options?: {
88
+ encoding?: string; // ✅ (utf8, ascii, latin1, base64, base64url, hex)
89
+ mode?: number; // ✅
90
+ flag?: string; // ✅
91
+ };
92
+ ```
93
+
94
+ ### `copyFile`
95
+
96
+ - **Node.js 参数**:
97
+ ```ts
98
+ src: string; // ✅
99
+ dest: string; // ✅
100
+ mode?: number; // ✅ (COPYFILE_EXCL)
101
+ ```
102
+
103
+ ### `cp`
104
+
105
+ - **Node.js 参数**(Node 16.7+):
106
+ ```ts
107
+ src: string; // ✅
108
+ dest: string; // ✅
109
+ options?: {
110
+ recursive?: boolean; // ✅
111
+ force?: boolean; // ✅(默认 true)
112
+ errorOnExist?: boolean; // ✅
113
+ preserveTimestamps?: boolean; // ✅
114
+ dereference?: boolean; // ✅
115
+ verbatimSymlinks?: boolean; // ✅
116
+ concurrency?: number; // ✨
117
+ };
118
+ ```
119
+
120
+ ### `mkdir`
121
+
122
+ - **Node.js 参数**:
123
+ ```ts
124
+ path: string; // ✅
125
+ options?: {
126
+ recursive?: boolean; // ✅
127
+ mode?: number; // ✅
128
+ };
129
+ ```
130
+ - **返回类型**:`string | undefined`(recursive 模式下返回首个创建的路径)
131
+
132
+ ### `rm`
133
+
134
+ - **Node.js 参数**:
135
+ ```ts
136
+ path: string; // ✅
137
+ options?: {
138
+ force?: boolean; // ✅
139
+ maxRetries?: number; // ✅
140
+ retryDelay?: number; // ✅(默认 100ms)
141
+ recursive?: boolean; // ✅
142
+ concurrency?: number; // ✨
143
+ };
144
+ ```
145
+
146
+ ### `rmdir`
147
+
148
+ - **Node.js 参数**:
149
+ ```ts
150
+ path: string // ✅
151
+ ```
152
+
153
+ ### `stat`
154
+
155
+ - **Node.js 参数**:
156
+ ```ts
157
+ path: string // ✅
158
+ ```
159
+ - **返回类型**:`Stats`
160
+ - 数值字段:`dev`, `mode`, `nlink`, `uid`, `gid`, `rdev`, `blksize`, `ino`, `size`, `blocks`, `atimeMs`, `mtimeMs`, `ctimeMs`, `birthtimeMs`
161
+ - **Date 字段**:`atime`, `mtime`, `ctime`, `birthtime` → `Date` 对象 ✅
162
+ - 方法:`isFile()`, `isDirectory()`, `isSymbolicLink()`, ...
163
+ - **错误区分**:`ENOENT` vs `EACCES` ✅
164
+
165
+ ### `lstat`
166
+
167
+ - **Node.js 参数**:
168
+ ```ts
169
+ path: string // ✅
170
+ ```
171
+ - **返回类型**:`Stats`
172
+
173
+ ### `fstat`
174
+
175
+ - **状态**:❌
176
+
177
+ ### `access`
178
+
179
+ - **Node.js 参数**:
180
+ ```ts
181
+ path: string; // ✅
182
+ mode?: number; // ✅ (F_OK, R_OK, W_OK, X_OK)
183
+ ```
184
+
185
+ ### `exists`
186
+
187
+ - **Node.js 参数**:
188
+ ```ts
189
+ path: string // ✅
190
+ ```
191
+ - **返回类型**:`boolean`
192
+
193
+ ### `open`
194
+
195
+ - **状态**:❌
196
+
197
+ ### `opendir`
198
+
199
+ - **状态**:❌
200
+
201
+ ### `close`
202
+
203
+ - **状态**:❌
204
+
205
+ ### `unlink`
206
+
207
+ - **Node.js 参数**:
208
+ ```ts
209
+ path: string // ✅
210
+ ```
211
+
212
+ ### `rename`
213
+
214
+ - **Node.js 参数**:
215
+ ```ts
216
+ oldPath: string // ✅
217
+ newPath: string // ✅
218
+ ```
219
+
220
+ ### `readlink`
221
+
222
+ - **Node.js 参数**:
223
+ ```ts
224
+ path: string // ✅
225
+ ```
226
+ - **返回类型**:`string`
227
+
228
+ ### `realpath`
229
+
230
+ - **Node.js 参数**:
231
+ ```ts
232
+ path: string // ✅
233
+ ```
234
+ - **返回类型**:`string`
235
+
236
+ ### `chmod`
237
+
238
+ - **Node.js 参数**:
239
+ ```ts
240
+ path: string // ✅
241
+ mode: number // ✅
242
+ ```
243
+
244
+ ### `chown`
245
+
246
+ - **Node.js 参数**:
247
+ ```ts
248
+ path: string // ✅
249
+ uid: number // ✅
250
+ gid: number // ✅
251
+ ```
252
+
253
+ ### `utimes`
254
+
255
+ - **Node.js 参数**:
256
+ ```ts
257
+ path: string // ✅
258
+ atime: number // ✅
259
+ mtime: number // ✅
260
+ ```
261
+
262
+ ### `truncate`
263
+
264
+ - **Node.js 参数**:
265
+ ```ts
266
+ path: string; // ✅
267
+ len?: number; // ✅
268
+ ```
269
+
270
+ ### `glob`
271
+
272
+ - **Node.js 参数**:
273
+ ```ts
274
+ pattern: string; // ✅
275
+ options?: {
276
+ cwd?: string; // ✅
277
+ withFileTypes?: boolean; // ✅
278
+ exclude?: string[]; // ✅
279
+ concurrency?: number; // ✨
280
+ gitIgnore?: boolean; // ✨
281
+ };
282
+ ```
283
+
284
+ ### `symlink`
285
+
286
+ - **Node.js 参数**:
287
+ ```ts
288
+ target: string // ✅
289
+ path: string // ✅
290
+ type?: 'file' | 'dir' | 'junction' // ✅(仅 Windows 有效,Unix 忽略)
291
+ ```
292
+
293
+ ### `link`
294
+
295
+ - **Node.js 参数**:
296
+ ```ts
297
+ existingPath: string // ✅
298
+ newPath: string // ✅
299
+ ```
300
+
301
+ ### `mkdtemp`
302
+
303
+ - **Node.js 参数**:
304
+ ```ts
305
+ prefix: string // ✅
306
+ ```
307
+ - **返回类型**:`string`
308
+ - 使用系统随机源(Unix: `/dev/urandom`,Windows: `BCryptGenRandom`),最多重试 10 次 ✅
309
+
310
+ ### `watch`
311
+
312
+ - **状态**:❌
313
+
314
+ ## 用法
315
+
316
+ ```ts
317
+ import { readdir, stat, readFile, writeFile, mkdir, rm } from 'hyper-fs'
318
+
319
+ // 读取目录
320
+ const files = await readdir('./src')
321
+
322
+ // 递归 + 返回文件类型
323
+ const entries = await readdir('./src', {
324
+ recursive: true,
325
+ withFileTypes: true,
326
+ })
327
+
328
+ // 读写文件
329
+ const content = await readFile('./package.json', { encoding: 'utf8' })
330
+ await writeFile('./output.txt', 'hello world')
331
+
332
+ // 文件信息
333
+ const s = await stat('./package.json')
334
+ console.log(s.size, s.isFile())
335
+
336
+ // 创建目录
337
+ await mkdir('./new-dir', { recursive: true })
338
+
339
+ // 删除
340
+ await rm('./temp', { recursive: true, force: true })
341
+ ```
342
+
343
+ ## 性能基准
344
+
345
+ > 测试环境:Apple Silicon (arm64),Node.js 24.0.2,release 构建(开启 LTO)。
346
+ > 运行 `pnpm build && pnpm bench` 可复现。
347
+
348
+ ### Hyper-FS 显著更快的场景
349
+
350
+ 这些场景中 Rust 的并行遍历和零拷贝 I/O 发挥了真正优势:
351
+
352
+ | 场景 | Node.js | Hyper-FS | 加速比 |
353
+ | ------------------------------------------- | --------- | -------- | --------- |
354
+ | `readdir` 递归(node_modules,约 3 万条目) | 281 ms | 23 ms | **12x** |
355
+ | `glob` 递归(`**/*.rs`) | 25 ms | 1.46 ms | **17x** |
356
+ | `glob` 递归 vs fast-glob | 102 ms | 1.46 ms | **70x** |
357
+ | `copyFile` 4 MB | 4.67 ms | 0.09 ms | **50x** |
358
+ | `readFile` 4 MB utf8 | 1.86 ms | 0.92 ms | **2x** |
359
+ | `readFile` 64 KB utf8 | 42 µs | 18 µs | **2.4x** |
360
+ | `rm` 2000 个文件(4 线程) | 92 ms | 53 ms | **1.75x** |
361
+ | `access` R_OK(目录) | 4.18 µs | 1.55 µs | **2.7x** |
362
+ | `cp` 500 文件平铺目录(4 线程) | 86.45 ms | 32.88 ms | **2.6x** |
363
+ | `cp` 树形目录 ~363 节点(4 线程) | 108.73 ms | 46.88 ms | **2.3x** |
364
+
365
+ ### 与 Node.js 持平的场景
366
+
367
+ 单文件操作有约 0.3 µs 的 napi 桥接开销,整体表现基本一致:
368
+
369
+ | 场景 | Node.js | Hyper-FS | 比率 |
370
+ | ---------------------------- | ------- | -------- | ---- |
371
+ | `stat`(单文件) | 1.45 µs | 1.77 µs | 1.2x |
372
+ | `readFile` 小文件(Buffer) | 8.86 µs | 9.46 µs | 1.1x |
373
+ | `writeFile` 小文件(string) | 74 µs | 66 µs | 0.9x |
374
+ | `writeFile` 小文件(Buffer) | 115 µs | 103 µs | 0.9x |
375
+ | `appendFile` | 30 µs | 27 µs | 0.9x |
376
+
377
+ ### Node.js 更快的场景
378
+
379
+ 极轻量级的内置调用,napi 开销占比较大:
380
+
381
+ | 场景 | Node.js | Hyper-FS | 说明 |
382
+ | -------------------------- | ------- | -------- | ------------------------ |
383
+ | `existsSync`(已存在文件) | 444 ns | 1.34 µs | Node.js 内部有 fast path |
384
+ | `accessSync` F_OK | 456 ns | 1.46 µs | 同上——napi 开销占主导 |
385
+ | `writeFile` 4 MB string | 2.93 ms | 5.69 ms | 大字符串跨 napi 桥传输 |
386
+
387
+ ### 并行支持
388
+
389
+ Hyper-FS 在文件系统遍历类操作中使用多线程并行:
390
+
391
+ | API | 并行库 | `concurrency` 选项 | 默认值 |
392
+ | ----------------- | ------------------------------------------------------------------------- | ------------------ | ------ |
393
+ | `readdir`(递归) | [jwalk](https://github.com/Byron/jwalk) | ✅ | auto |
394
+ | `glob` | [ignore](https://github.com/BurntSushi/ripgrep/tree/master/crates/ignore) | ✅ | 4 |
395
+ | `rm`(递归) | [rayon](https://github.com/rayon-rs/rayon) | ✅ | 1 |
396
+ | `cp`(递归) | [rayon](https://github.com/rayon-rs/rayon) | ✅ | 1 |
397
+
398
+ 单文件操作(`stat`、`readFile`、`writeFile`、`chmod` 等)是原子系统调用,不适用并行化。
399
+
400
+ ### 核心结论
401
+
402
+ **Hyper-FS 在递归/批量文件系统操作上表现卓越**(readdir、glob、rm、cp),Rust 的并行遍历器带来 2–70 倍加速。单文件操作与 Node.js 基本持平。napi 桥接带来固定约 0.3 µs 的每次调用开销,仅在亚微秒级操作(如 `existsSync`)中有感知。
403
+
404
+ **`cp` 基准详情**(Apple Silicon,release 构建):
405
+
406
+ | 场景 | Node.js | Hyper-FS 1 线程 | Hyper-FS 4 线程 | Hyper-FS 8 线程 |
407
+ | ------------------------------------- | --------- | --------------- | --------------- | --------------- |
408
+ | 平铺目录(500 文件) | 86.45 ms | 61.56 ms | 32.88 ms | 36.67 ms |
409
+ | 树形目录(宽度=4,深度=3,~84 节点) | 23.80 ms | 16.94 ms | 10.62 ms | 9.76 ms |
410
+ | 树形目录(宽度=3,深度=5,~363 节点) | 108.73 ms | 75.39 ms | 46.88 ms | 46.18 ms |
411
+
412
+ `cp` 的最优并发数在 Apple Silicon 上为 **4 线程**——超过后受 I/O 带宽限制,收益趋于平稳。
413
+
414
+ ## 贡献
415
+
416
+ 参阅 [CONTRIBUTING.md](./CONTRIBUTING.md) — 完整的开发指南,涵盖环境搭建、参考 Node.js 源码、编写 Rust 实现、测试与性能基准。
417
+
418
+ ## 许可证
419
+
420
+ MIT
package/index.d.ts ADDED
@@ -0,0 +1,251 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+ export declare class Dirent {
4
+ readonly name: string
5
+ readonly parentPath: string
6
+ isFile(): boolean
7
+ isDirectory(): boolean
8
+ isSymbolicLink(): boolean
9
+ isBlockDevice(): boolean
10
+ isCharacterDevice(): boolean
11
+ isFIFO(): boolean
12
+ isSocket(): boolean
13
+ get path(): string
14
+ }
15
+
16
+ export declare class Stats {
17
+ readonly dev: number
18
+ readonly mode: number
19
+ readonly nlink: number
20
+ readonly uid: number
21
+ readonly gid: number
22
+ readonly rdev: number
23
+ readonly blksize: number
24
+ readonly ino: number
25
+ readonly size: number
26
+ readonly blocks: number
27
+ readonly atimeMs: number
28
+ readonly mtimeMs: number
29
+ readonly ctimeMs: number
30
+ readonly birthtimeMs: number
31
+ isFile(): boolean
32
+ isDirectory(): boolean
33
+ isSymbolicLink(): boolean
34
+ isBlockDevice(): boolean
35
+ isCharacterDevice(): boolean
36
+ isFIFO(): boolean
37
+ isSocket(): boolean
38
+ /** Returns atime as a Date object (Node.js compatible) */
39
+ get atime(): Date
40
+ /** Returns mtime as a Date object (Node.js compatible) */
41
+ get mtime(): Date
42
+ /** Returns ctime as a Date object (Node.js compatible) */
43
+ get ctime(): Date
44
+ /** Returns birthtime as a Date object (Node.js compatible) */
45
+ get birthtime(): Date
46
+ }
47
+
48
+ export declare function access(path: string, mode?: number | undefined | null): Promise<unknown>
49
+
50
+ export declare function accessSync(path: string, mode?: number | undefined | null): void
51
+
52
+ export declare function appendFile(
53
+ path: string,
54
+ data: string | Buffer,
55
+ options?: WriteFileOptions | undefined | null,
56
+ ): Promise<unknown>
57
+
58
+ export declare function appendFileSync(
59
+ path: string,
60
+ data: string | Buffer,
61
+ options?: WriteFileOptions | undefined | null,
62
+ ): void
63
+
64
+ export declare function chmod(path: string, mode: number): Promise<unknown>
65
+
66
+ export declare function chmodSync(path: string, mode: number): void
67
+
68
+ export declare function chown(path: string, uid: number, gid: number): Promise<unknown>
69
+
70
+ export declare function chownSync(path: string, uid: number, gid: number): void
71
+
72
+ export declare function copyFile(src: string, dest: string, mode?: number | undefined | null): Promise<unknown>
73
+
74
+ export declare function copyFileSync(src: string, dest: string, mode?: number | undefined | null): void
75
+
76
+ export declare function cp(src: string, dest: string, options?: CpOptions | undefined | null): Promise<unknown>
77
+
78
+ export interface CpOptions {
79
+ recursive?: boolean
80
+ force?: boolean
81
+ errorOnExist?: boolean
82
+ preserveTimestamps?: boolean
83
+ dereference?: boolean
84
+ verbatimSymlinks?: boolean
85
+ /**
86
+ * Hyper-FS extension: number of parallel threads for recursive copy.
87
+ * 0 or 1 means sequential; > 1 enables rayon parallel traversal.
88
+ */
89
+ concurrency?: number
90
+ }
91
+
92
+ export declare function cpSync(src: string, dest: string, options?: CpOptions | undefined | null): void
93
+
94
+ export declare function exists(path: string): Promise<unknown>
95
+
96
+ export declare function existsSync(path: string): boolean
97
+
98
+ export declare function glob(pattern: string, options?: GlobOptions | undefined | null): Promise<unknown>
99
+
100
+ export interface GlobOptions {
101
+ cwd?: string
102
+ withFileTypes?: boolean
103
+ exclude?: Array<string>
104
+ concurrency?: number
105
+ gitIgnore?: boolean
106
+ }
107
+
108
+ export declare function globSync(
109
+ pattern: string,
110
+ options?: GlobOptions | undefined | null,
111
+ ): Array<string> | Array<Dirent>
112
+
113
+ export declare function link(existingPath: string, newPath: string): Promise<unknown>
114
+
115
+ export declare function linkSync(existingPath: string, newPath: string): void
116
+
117
+ export declare function lstat(path: string): Promise<unknown>
118
+
119
+ export declare function lstatSync(path: string): Stats
120
+
121
+ export declare function mkdir(path: string, options?: MkdirOptions | undefined | null): Promise<unknown>
122
+
123
+ export interface MkdirOptions {
124
+ recursive?: boolean
125
+ mode?: number
126
+ }
127
+
128
+ export declare function mkdirSync(path: string, options?: MkdirOptions | undefined | null): string | null
129
+
130
+ export declare function mkdtemp(prefix: string): Promise<unknown>
131
+
132
+ export declare function mkdtempSync(prefix: string): string
133
+
134
+ export declare function readdir(path: string, options?: ReaddirOptions | undefined | null): Promise<unknown>
135
+
136
+ /** * Reads the contents of a directory.
137
+ * @param {string | Buffer | URL} path
138
+ * @param {string | {
139
+ * encoding?: string;
140
+ * withFileTypes?: boolean;
141
+ * recursive?: boolean;
142
+ * }} [options]
143
+ * @param {(
144
+ * err?: Error,
145
+ * files?: string[] | Buffer[] | Dirent[]
146
+ * ) => any} callback
147
+ * @returns {void}
148
+ */
149
+ export interface ReaddirOptions {
150
+ /**
151
+ * File name encoding. 'utf8' (default) returns strings.
152
+ * 'buffer' returns Buffer objects for each name.
153
+ * Other values are treated as 'utf8'.
154
+ */
155
+ encoding?: string
156
+ skipHidden?: boolean
157
+ concurrency?: number
158
+ recursive?: boolean
159
+ withFileTypes?: boolean
160
+ }
161
+
162
+ export declare function readdirSync(
163
+ path: string,
164
+ options?: ReaddirOptions | undefined | null,
165
+ ): Array<string> | Array<Dirent>
166
+
167
+ export declare function readFile(path: string, options?: ReadFileOptions | undefined | null): Promise<unknown>
168
+
169
+ export interface ReadFileOptions {
170
+ encoding?: string
171
+ flag?: string
172
+ }
173
+
174
+ export declare function readFileSync(path: string, options?: ReadFileOptions | undefined | null): string | Buffer
175
+
176
+ export declare function readlink(path: string): Promise<unknown>
177
+
178
+ export declare function readlinkSync(path: string): string
179
+
180
+ export declare function realpath(path: string): Promise<unknown>
181
+
182
+ export declare function realpathSync(path: string): string
183
+
184
+ export declare function rename(oldPath: string, newPath: string): Promise<unknown>
185
+
186
+ export declare function renameSync(oldPath: string, newPath: string): void
187
+
188
+ export declare function rm(path: string, options?: RmOptions | undefined | null): Promise<unknown>
189
+
190
+ export declare function rmdir(path: string): Promise<unknown>
191
+
192
+ export declare function rmdirSync(path: string): void
193
+
194
+ /**
195
+ * Removes files and directories (modeled on the standard POSIX `rm` utility).
196
+ *
197
+ * - `force`: When true, silently ignore errors when path does not exist.
198
+ * - `recursive`: When true, remove directory and all its contents.
199
+ * - `maxRetries`: If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or `EPERM` error is
200
+ * encountered, Node.js retries the operation with a linear backoff of `retryDelay` ms longer on
201
+ * each try. This option represents the number of retries.
202
+ * - `retryDelay`: The amount of time in milliseconds to wait between retries (default 100ms).
203
+ * - `concurrency` (hyper-fs extension): Number of parallel threads for recursive removal.
204
+ */
205
+ export interface RmOptions {
206
+ force?: boolean
207
+ maxRetries?: number
208
+ recursive?: boolean
209
+ retryDelay?: number
210
+ concurrency?: number
211
+ }
212
+
213
+ export declare function rmSync(path: string, options?: RmOptions | undefined | null): void
214
+
215
+ export declare function stat(path: string): Promise<unknown>
216
+
217
+ export declare function statSync(path: string): Stats
218
+
219
+ export declare function symlink(target: string, path: string, symlinkType?: string | undefined | null): Promise<unknown>
220
+
221
+ export declare function symlinkSync(target: string, path: string, symlinkType?: string | undefined | null): void
222
+
223
+ export declare function truncate(path: string, len?: number | undefined | null): Promise<unknown>
224
+
225
+ export declare function truncateSync(path: string, len?: number | undefined | null): void
226
+
227
+ export declare function unlink(path: string): Promise<unknown>
228
+
229
+ export declare function unlinkSync(path: string): void
230
+
231
+ export declare function utimes(path: string, atime: number, mtime: number): Promise<unknown>
232
+
233
+ export declare function utimesSync(path: string, atime: number, mtime: number): void
234
+
235
+ export declare function writeFile(
236
+ path: string,
237
+ data: string | Buffer,
238
+ options?: WriteFileOptions | undefined | null,
239
+ ): Promise<unknown>
240
+
241
+ export interface WriteFileOptions {
242
+ encoding?: string
243
+ mode?: number
244
+ flag?: string
245
+ }
246
+
247
+ export declare function writeFileSync(
248
+ path: string,
249
+ data: string | Buffer,
250
+ options?: WriteFileOptions | undefined | null,
251
+ ): void