rush-fs 0.0.4 → 0.0.5
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/README.md +123 -137
- package/README.zh-CN.md +169 -126
- package/index.js +105 -105
- package/package.json +8 -5
package/README.md
CHANGED
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
# Rush-FS
|
|
4
4
|
|
|
5
|
+
[English](./README.md) | [中文](./README.zh-CN.md)
|
|
6
|
+
|
|
5
7
|
<p align="center">
|
|
6
8
|
<img src="https://img.shields.io/badge/Written%20in-Rust-orange?style=flat-square" alt="Written in Rust">
|
|
7
9
|
<img src="https://img.shields.io/npm/v/rush-fs?style=flat-square" alt="NPM Version">
|
|
8
10
|
<img src="https://img.shields.io/npm/l/rush-fs?style=flat-square" alt="License">
|
|
11
|
+
<a href="https://github.com/CoderSerio/rush-fs/graphs/contributors"><img src="https://img.shields.io/github/contributors/CoderSerio/rush-fs?style=flat-square" alt="Contributors"></a>
|
|
9
12
|
</p>
|
|
10
13
|
|
|
11
14
|
<p align="center">
|
|
12
|
-
|
|
15
|
+
API-aligned with Node.js <code>fs</code> for painless drop-in replacement in existing projects; get multi-fold performance in heavy file operations, powered by Rust.
|
|
13
16
|
</p>
|
|
14
17
|
|
|
15
18
|
</div>
|
|
@@ -22,7 +25,116 @@ npm install rush-fs
|
|
|
22
25
|
pnpm add rush-fs
|
|
23
26
|
```
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
When you install `rush-fs`, the package manager should automatically install the **platform-specific native binding** for your OS/arch via `optionalDependencies` (e.g. `@rush-fs/rush-fs-darwin-arm64` on macOS ARM). If the native binding is missing and you see "Cannot find native binding", try:
|
|
29
|
+
|
|
30
|
+
1. Remove `node_modules` and the lockfile (`package-lock.json` or `pnpm-lock.yaml`), then run `pnpm install` (or `npm i`) again.
|
|
31
|
+
2. Or install the platform package explicitly:
|
|
32
|
+
**macOS ARM:** `pnpm add @rush-fs/rush-fs-darwin-arm64`
|
|
33
|
+
**macOS x64:** `pnpm add @rush-fs/rush-fs-darwin-x64`
|
|
34
|
+
**Windows x64:** `pnpm add @rush-fs/rush-fs-win32-x64-msvc`
|
|
35
|
+
**Linux x64 (glibc):** `pnpm add @rush-fs/rush-fs-linux-x64-gnu`
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { readdir, stat, readFile, writeFile, mkdir, rm } from 'rush-fs'
|
|
41
|
+
|
|
42
|
+
// Read directory
|
|
43
|
+
const files = await readdir('./src')
|
|
44
|
+
|
|
45
|
+
// Recursive with file types
|
|
46
|
+
const entries = await readdir('./src', {
|
|
47
|
+
recursive: true,
|
|
48
|
+
withFileTypes: true,
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
// Read / write files
|
|
52
|
+
const content = await readFile('./package.json', { encoding: 'utf8' })
|
|
53
|
+
await writeFile('./output.txt', 'hello world')
|
|
54
|
+
|
|
55
|
+
// File stats
|
|
56
|
+
const s = await stat('./package.json')
|
|
57
|
+
console.log(s.size, s.isFile())
|
|
58
|
+
|
|
59
|
+
// Create directory
|
|
60
|
+
await mkdir('./new-dir', { recursive: true })
|
|
61
|
+
|
|
62
|
+
// Remove
|
|
63
|
+
await rm('./temp', { recursive: true, force: true })
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Benchmarks
|
|
67
|
+
|
|
68
|
+
> Tested on Apple Silicon (arm64), Node.js 24.0.2, release build with LTO.
|
|
69
|
+
> Run `pnpm build && pnpm bench` to reproduce.
|
|
70
|
+
|
|
71
|
+
### Where Rush-FS Shines
|
|
72
|
+
|
|
73
|
+
These are the scenarios where Rust's parallelism and zero-copy I/O make a real difference:
|
|
74
|
+
|
|
75
|
+
| Scenario | Node.js | Rush-FS | Speedup |
|
|
76
|
+
| ------------------------------------------------ | --------- | -------- | --------- |
|
|
77
|
+
| `readdir` recursive (node_modules, ~30k entries) | 281 ms | 23 ms | **12x** |
|
|
78
|
+
| `glob` recursive (`**/*.rs`) | 25 ms | 1.46 ms | **17x** |
|
|
79
|
+
| `glob` recursive vs fast-glob | 102 ms | 1.46 ms | **70x** |
|
|
80
|
+
| `copyFile` 4 MB | 4.67 ms | 0.09 ms | **50x** |
|
|
81
|
+
| `readFile` 4 MB utf8 | 1.86 ms | 0.92 ms | **2x** |
|
|
82
|
+
| `readFile` 64 KB utf8 | 42 µs | 18 µs | **2.4x** |
|
|
83
|
+
| `rm` 2000 files (4 threads) | 92 ms | 53 ms | **1.75x** |
|
|
84
|
+
| `access` R_OK (directory) | 4.18 µs | 1.55 µs | **2.7x** |
|
|
85
|
+
| `cp` 500-file flat dir (4 threads) | 86.45 ms | 32.88 ms | **2.6x** |
|
|
86
|
+
| `cp` tree dir ~363 nodes (4 threads) | 108.73 ms | 46.88 ms | **2.3x** |
|
|
87
|
+
|
|
88
|
+
### On Par with Node.js
|
|
89
|
+
|
|
90
|
+
Single-file operations have a ~0.3 µs napi bridge overhead, making them roughly equivalent:
|
|
91
|
+
|
|
92
|
+
| Scenario | Node.js | Rush-FS | Ratio |
|
|
93
|
+
| -------------------------- | ------- | ------- | ----- |
|
|
94
|
+
| `stat` (single file) | 1.45 µs | 1.77 µs | 1.2x |
|
|
95
|
+
| `readFile` small (Buffer) | 8.86 µs | 9.46 µs | 1.1x |
|
|
96
|
+
| `writeFile` small (string) | 74 µs | 66 µs | 0.9x |
|
|
97
|
+
| `writeFile` small (Buffer) | 115 µs | 103 µs | 0.9x |
|
|
98
|
+
| `appendFile` | 30 µs | 27 µs | 0.9x |
|
|
99
|
+
|
|
100
|
+
### Where Node.js Wins
|
|
101
|
+
|
|
102
|
+
Lightweight built-in calls where napi overhead is proportionally large:
|
|
103
|
+
|
|
104
|
+
| Scenario | Node.js | Rush-FS | Note |
|
|
105
|
+
| ---------------------------- | ------- | ------- | --------------------------------- |
|
|
106
|
+
| `existsSync` (existing file) | 444 ns | 1.34 µs | Node.js internal fast path |
|
|
107
|
+
| `accessSync` F_OK | 456 ns | 1.46 µs | Same — napi overhead dominates |
|
|
108
|
+
| `writeFile` 4 MB string | 2.93 ms | 5.69 ms | Large string crossing napi bridge |
|
|
109
|
+
|
|
110
|
+
### Parallelism
|
|
111
|
+
|
|
112
|
+
Rush-FS uses multi-threaded parallelism for operations that traverse the filesystem:
|
|
113
|
+
|
|
114
|
+
| API | Library | `concurrency` option | Default |
|
|
115
|
+
| --------------------- | ------------------------------------------------------------------------- | -------------------- | ------- |
|
|
116
|
+
| `readdir` (recursive) | [jwalk](https://github.com/Byron/jwalk) | ✅ | auto |
|
|
117
|
+
| `glob` | [ignore](https://github.com/BurntSushi/ripgrep/tree/master/crates/ignore) | ✅ | 4 |
|
|
118
|
+
| `rm` (recursive) | [rayon](https://github.com/rayon-rs/rayon) | ✅ | 1 |
|
|
119
|
+
| `cp` (recursive) | [rayon](https://github.com/rayon-rs/rayon) | ✅ | 1 |
|
|
120
|
+
|
|
121
|
+
Single-file operations (`stat`, `readFile`, `writeFile`, `chmod`, etc.) are atomic syscalls — parallelism does not apply.
|
|
122
|
+
|
|
123
|
+
### Key Takeaway
|
|
124
|
+
|
|
125
|
+
**Rush-FS excels at recursive / batch filesystem operations** (readdir, glob, rm, cp) where Rust's parallel walkers deliver 2–70x speedups. For single-file operations it performs on par with Node.js. The napi bridge adds a fixed ~0.3 µs overhead per call, which only matters for sub-microsecond operations like `existsSync`.
|
|
126
|
+
|
|
127
|
+
**`cp` benchmark detail** (Apple Silicon, release build):
|
|
128
|
+
|
|
129
|
+
| Scenario | Node.js | Rush-FS 1T | Rush-FS 4T | Rush-FS 8T |
|
|
130
|
+
| ----------------------------------------- | --------- | ---------- | ---------- | ---------- |
|
|
131
|
+
| Flat dir (500 files) | 86.45 ms | 61.56 ms | 32.88 ms | 36.67 ms |
|
|
132
|
+
| Tree dir (breadth=4, depth=3, ~84 nodes) | 23.80 ms | 16.94 ms | 10.62 ms | 9.76 ms |
|
|
133
|
+
| Tree dir (breadth=3, depth=5, ~363 nodes) | 108.73 ms | 75.39 ms | 46.88 ms | 46.18 ms |
|
|
134
|
+
|
|
135
|
+
Optimal concurrency for `cp` is **4 threads** on Apple Silicon — beyond that, I/O bandwidth becomes the bottleneck and diminishing returns set in.
|
|
136
|
+
|
|
137
|
+
## How it works
|
|
26
138
|
|
|
27
139
|
For the original Node.js, it works serially and cost lots of memory to parse os object and string into JS style:
|
|
28
140
|
|
|
@@ -80,7 +192,7 @@ We are rewriting `fs` APIs one by one.
|
|
|
80
192
|
>
|
|
81
193
|
> - ✅: Fully Supported
|
|
82
194
|
> - 🚧: Partially Supported / WIP
|
|
83
|
-
> -
|
|
195
|
+
> - ✨: New feature from rush-fs
|
|
84
196
|
> - ❌: Not Supported Yet
|
|
85
197
|
|
|
86
198
|
### `readdir`
|
|
@@ -363,149 +475,23 @@ We are rewriting `fs` APIs one by one.
|
|
|
363
475
|
|
|
364
476
|
- **Status**: ❌
|
|
365
477
|
|
|
366
|
-
##
|
|
367
|
-
|
|
368
|
-
```ts
|
|
369
|
-
import { readdir, stat, readFile, writeFile, mkdir, rm } from 'rush-fs'
|
|
370
|
-
|
|
371
|
-
// Read directory
|
|
372
|
-
const files = await readdir('./src')
|
|
373
|
-
|
|
374
|
-
// Recursive with file types
|
|
375
|
-
const entries = await readdir('./src', {
|
|
376
|
-
recursive: true,
|
|
377
|
-
withFileTypes: true,
|
|
378
|
-
})
|
|
478
|
+
## Changelog
|
|
379
479
|
|
|
380
|
-
|
|
381
|
-
const content = await readFile('./package.json', { encoding: 'utf8' })
|
|
382
|
-
await writeFile('./output.txt', 'hello world')
|
|
383
|
-
|
|
384
|
-
// File stats
|
|
385
|
-
const s = await stat('./package.json')
|
|
386
|
-
console.log(s.size, s.isFile())
|
|
387
|
-
|
|
388
|
-
// Create directory
|
|
389
|
-
await mkdir('./new-dir', { recursive: true })
|
|
390
|
-
|
|
391
|
-
// Remove
|
|
392
|
-
await rm('./temp', { recursive: true, force: true })
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
## Benchmarks
|
|
396
|
-
|
|
397
|
-
> Tested on Apple Silicon (arm64), Node.js 24.0.2, release build with LTO.
|
|
398
|
-
> Run `pnpm build && pnpm bench` to reproduce.
|
|
399
|
-
|
|
400
|
-
### Where Rush-FS Shines
|
|
401
|
-
|
|
402
|
-
These are the scenarios where Rust's parallelism and zero-copy I/O make a real difference:
|
|
403
|
-
|
|
404
|
-
| Scenario | Node.js | Rush-FS | Speedup |
|
|
405
|
-
| ------------------------------------------------ | --------- | -------- | --------- |
|
|
406
|
-
| `readdir` recursive (node_modules, ~30k entries) | 281 ms | 23 ms | **12x** |
|
|
407
|
-
| `glob` recursive (`**/*.rs`) | 25 ms | 1.46 ms | **17x** |
|
|
408
|
-
| `glob` recursive vs fast-glob | 102 ms | 1.46 ms | **70x** |
|
|
409
|
-
| `copyFile` 4 MB | 4.67 ms | 0.09 ms | **50x** |
|
|
410
|
-
| `readFile` 4 MB utf8 | 1.86 ms | 0.92 ms | **2x** |
|
|
411
|
-
| `readFile` 64 KB utf8 | 42 µs | 18 µs | **2.4x** |
|
|
412
|
-
| `rm` 2000 files (4 threads) | 92 ms | 53 ms | **1.75x** |
|
|
413
|
-
| `access` R_OK (directory) | 4.18 µs | 1.55 µs | **2.7x** |
|
|
414
|
-
| `cp` 500-file flat dir (4 threads) | 86.45 ms | 32.88 ms | **2.6x** |
|
|
415
|
-
| `cp` tree dir ~363 nodes (4 threads) | 108.73 ms | 46.88 ms | **2.3x** |
|
|
416
|
-
|
|
417
|
-
### On Par with Node.js
|
|
418
|
-
|
|
419
|
-
Single-file operations have a ~0.3 µs napi bridge overhead, making them roughly equivalent:
|
|
420
|
-
|
|
421
|
-
| Scenario | Node.js | Rush-FS | Ratio |
|
|
422
|
-
| -------------------------- | ------- | ------- | ----- |
|
|
423
|
-
| `stat` (single file) | 1.45 µs | 1.77 µs | 1.2x |
|
|
424
|
-
| `readFile` small (Buffer) | 8.86 µs | 9.46 µs | 1.1x |
|
|
425
|
-
| `writeFile` small (string) | 74 µs | 66 µs | 0.9x |
|
|
426
|
-
| `writeFile` small (Buffer) | 115 µs | 103 µs | 0.9x |
|
|
427
|
-
| `appendFile` | 30 µs | 27 µs | 0.9x |
|
|
428
|
-
|
|
429
|
-
### Where Node.js Wins
|
|
430
|
-
|
|
431
|
-
Lightweight built-in calls where napi overhead is proportionally large:
|
|
432
|
-
|
|
433
|
-
| Scenario | Node.js | Rush-FS | Note |
|
|
434
|
-
| ---------------------------- | ------- | ------- | --------------------------------- |
|
|
435
|
-
| `existsSync` (existing file) | 444 ns | 1.34 µs | Node.js internal fast path |
|
|
436
|
-
| `accessSync` F_OK | 456 ns | 1.46 µs | Same — napi overhead dominates |
|
|
437
|
-
| `writeFile` 4 MB string | 2.93 ms | 5.69 ms | Large string crossing napi bridge |
|
|
438
|
-
|
|
439
|
-
### Parallelism
|
|
440
|
-
|
|
441
|
-
Rush-FS uses multi-threaded parallelism for operations that traverse the filesystem:
|
|
442
|
-
|
|
443
|
-
| API | Library | `concurrency` option | Default |
|
|
444
|
-
| --------------------- | ------------------------------------------------------------------------- | -------------------- | ------- |
|
|
445
|
-
| `readdir` (recursive) | [jwalk](https://github.com/Byron/jwalk) | ✅ | auto |
|
|
446
|
-
| `glob` | [ignore](https://github.com/BurntSushi/ripgrep/tree/master/crates/ignore) | ✅ | 4 |
|
|
447
|
-
| `rm` (recursive) | [rayon](https://github.com/rayon-rs/rayon) | ✅ | 1 |
|
|
448
|
-
| `cp` (recursive) | [rayon](https://github.com/rayon-rs/rayon) | ✅ | 1 |
|
|
449
|
-
|
|
450
|
-
Single-file operations (`stat`, `readFile`, `writeFile`, `chmod`, etc.) are atomic syscalls — parallelism does not apply.
|
|
451
|
-
|
|
452
|
-
### Key Takeaway
|
|
453
|
-
|
|
454
|
-
**Rush-FS excels at recursive / batch filesystem operations** (readdir, glob, rm, cp) where Rust's parallel walkers deliver 2–70x speedups. For single-file operations it performs on par with Node.js. The napi bridge adds a fixed ~0.3 µs overhead per call, which only matters for sub-microsecond operations like `existsSync`.
|
|
455
|
-
|
|
456
|
-
**`cp` benchmark detail** (Apple Silicon, release build):
|
|
457
|
-
|
|
458
|
-
| Scenario | Node.js | Rush-FS 1T | Rush-FS 4T | Rush-FS 8T |
|
|
459
|
-
| ----------------------------------------- | --------- | ---------- | ---------- | ---------- |
|
|
460
|
-
| Flat dir (500 files) | 86.45 ms | 61.56 ms | 32.88 ms | 36.67 ms |
|
|
461
|
-
| Tree dir (breadth=4, depth=3, ~84 nodes) | 23.80 ms | 16.94 ms | 10.62 ms | 9.76 ms |
|
|
462
|
-
| Tree dir (breadth=3, depth=5, ~363 nodes) | 108.73 ms | 75.39 ms | 46.88 ms | 46.18 ms |
|
|
463
|
-
|
|
464
|
-
Optimal concurrency for `cp` is **4 threads** on Apple Silicon — beyond that, I/O bandwidth becomes the bottleneck and diminishing returns set in.
|
|
480
|
+
See [CHANGELOG.md](./CHANGELOG.md) for a summary of changes in each version. Release tags are listed in [GitHub Releases](https://github.com/CoderSerio/rush-fs/releases).
|
|
465
481
|
|
|
466
482
|
## Contributing
|
|
467
483
|
|
|
468
|
-
See [CONTRIBUTING.md](./CONTRIBUTING.md) for the
|
|
484
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for the full development guide: environment setup, Node.js reference, Rust implementation, testing, and benchmarking.
|
|
469
485
|
|
|
470
486
|
## Publishing (Maintainers Only)
|
|
471
487
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
```json
|
|
475
|
-
"optionalDependencies": {
|
|
476
|
-
"rush-fs-win32-x64-msvc": "<version>",
|
|
477
|
-
"rush-fs-darwin-x64": "<version>",
|
|
478
|
-
"rush-fs-linux-x64-gnu": "<version>",
|
|
479
|
-
"rush-fs-darwin-arm64": "<version>"
|
|
480
|
-
}
|
|
481
|
-
```
|
|
482
|
-
|
|
483
|
-
Then publish both the platform-specific packages and the main package **in order**:
|
|
484
|
-
|
|
485
|
-
1. Ensure you are logged in to npm (`npm login`).
|
|
486
|
-
2. Bump the version via `pnpm version <patch|minor|major>`. This runs `pnpm preversion`, which builds the `.node` for the **current platform only** (output is in the crate root, not under `npm/`). **To verify the Mac build:** after `pnpm build` or `preversion`, check that the crate root contains `rush-fs.darwin-arm64.node` (Apple Silicon) or `rush-fs.darwin-x64.node` (Intel Mac). For `prepublishOnly` to see it, you must have the file under `npm/<platform>/` (see "Local single-platform publish" below).
|
|
487
|
-
3. Run `pnpm prepublishOnly` (which runs `napi prepublish -t npm`) to publish each built package from `npm/` (e.g. `rush-fs-darwin-arm64`, `rush-fs-win32-x64-msvc`). **If you see "doesn't exist" here,** the `.node` is not in `npm/` yet—either use CI to build all platforms, or for local Mac-only: run `napi create-npm-dirs`, then copy `rush-fs.darwin-arm64.node` (or `darwin-x64`) into `npm/darwin-arm64/` (or `npm/darwin-x64/`), then run `pnpm prepublishOnly` again.
|
|
488
|
-
4. Publish the main package with `pnpm publish --access public`. The `prepublishOnly` hook runs automatically, but running step 3 manually lets you verify each platform succeeded before tagging the main release.
|
|
489
|
-
|
|
490
|
-
If any platform publish fails, fix it and re-run `pnpm prepublishOnly` before retrying `pnpm publish` so consumers never receive a release referring to missing optional dependencies.
|
|
491
|
-
|
|
492
|
-
### How to verify the Mac build (方式 B 第 2 步后)
|
|
493
|
-
|
|
494
|
-
- **Apple Silicon (M1/M2/M3):** in the repo root, a file named `rush-fs.darwin-arm64.node` must exist.
|
|
495
|
-
- **Intel Mac:** in the repo root, a file named `rush-fs.darwin-x64.node` must exist.
|
|
496
|
-
|
|
497
|
-
Command to check: `ls -la rush-fs.darwin-*.node` in the package directory. If you see the file, the Mac native build succeeded.
|
|
498
|
-
|
|
499
|
-
### Local single-platform publish (Mac only)
|
|
488
|
+
Releases are handled by the [Release workflow](.github/workflows/Release.yml): it builds native binaries for macOS (x64/arm64), Windows, and Linux, then publishes the platform packages and the main package to npm.
|
|
500
489
|
|
|
501
|
-
|
|
490
|
+
1. **Secrets:** In the repo **Settings → Secrets and variables → Actions**, add **NPM_TOKEN** (npm Classic or Automation token with Publish permission).
|
|
491
|
+
2. **Release:** Either run **Actions → Release → Run workflow** (uses the current `package.json` version on `main`), or bump version in `package.json` and `Cargo.toml`, push to `main`, then create and push a tag: `git tag v<version> && git push origin v<version>`.
|
|
492
|
+
3. **Changelog:** Update [CHANGELOG.md](./CHANGELOG.md) before or right after the release (move entries from `[Unreleased]` to a new version heading and add the compare link).
|
|
502
493
|
|
|
503
|
-
|
|
504
|
-
2. `napi create-npm-dirs` to create `npm/darwin-arm64/` (and other platform dirs).
|
|
505
|
-
3. Copy the built `.node` into the matching npm dir, e.g.
|
|
506
|
-
`cp rush-fs.darwin-arm64.node npm/darwin-arm64/`
|
|
507
|
-
4. `pnpm prepublishOnly` — only the Mac platform package will be published; others will show "doesn't exist" (expected).
|
|
508
|
-
5. `pnpm publish --access public`. Users on other platforms will need to build from source or you publish those platform packages later via CI.
|
|
494
|
+
The workflow injects `optionalDependencies` and publishes all packages; no need to edit `package.json` manually for release.
|
|
509
495
|
|
|
510
496
|
## License
|
|
511
497
|
|
package/README.zh-CN.md
CHANGED
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
<img src="https://img.shields.io/badge/Written%20in-Rust-orange?style=flat-square" alt="Written in Rust">
|
|
9
9
|
<img src="https://img.shields.io/npm/v/rush-fs?style=flat-square" alt="NPM Version">
|
|
10
10
|
<img src="https://img.shields.io/npm/l/rush-fs?style=flat-square" alt="License">
|
|
11
|
+
<a href="https://github.com/CoderSerio/rush-fs/graphs/contributors"><img src="https://img.shields.io/github/contributors/CoderSerio/rush-fs?style=flat-square" alt="Contributors"></a>
|
|
11
12
|
</p>
|
|
12
13
|
|
|
13
14
|
<p align="center">
|
|
14
|
-
|
|
15
|
+
与 Node.js <code>fs</code> API 对齐,可无痛替换现有项目中的 fs;在海量文件操作场景下获得数倍于内置 fs 的性能,由 Rust 驱动。
|
|
15
16
|
</p>
|
|
16
17
|
</div>
|
|
17
18
|
|
|
@@ -23,6 +24,165 @@ npm install rush-fs
|
|
|
23
24
|
pnpm add rush-fs
|
|
24
25
|
```
|
|
25
26
|
|
|
27
|
+
安装 `rush-fs` 时,包管理器会通过 `optionalDependencies` 自动安装**当前平台**的本地绑定(例如 macOS ARM 上的 `@rush-fs/rush-fs-darwin-arm64`)。若未安装或出现「Cannot find native binding」:
|
|
28
|
+
|
|
29
|
+
1. 删除 `node_modules` 和锁文件(`package-lock.json` 或 `pnpm-lock.yaml`)后重新执行 `pnpm install`(或 `npm i`)。
|
|
30
|
+
2. 或手动安装对应平台包:
|
|
31
|
+
**macOS ARM:** `pnpm add @rush-fs/rush-fs-darwin-arm64`
|
|
32
|
+
**macOS x64:** `pnpm add @rush-fs/rush-fs-darwin-x64`
|
|
33
|
+
**Windows x64:** `pnpm add @rush-fs/rush-fs-win32-x64-msvc`
|
|
34
|
+
**Linux x64 (glibc):** `pnpm add @rush-fs/rush-fs-linux-x64-gnu`
|
|
35
|
+
|
|
36
|
+
## 用法
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { readdir, stat, readFile, writeFile, mkdir, rm } from 'rush-fs'
|
|
40
|
+
|
|
41
|
+
// 读取目录
|
|
42
|
+
const files = await readdir('./src')
|
|
43
|
+
|
|
44
|
+
// 递归 + 返回文件类型
|
|
45
|
+
const entries = await readdir('./src', {
|
|
46
|
+
recursive: true,
|
|
47
|
+
withFileTypes: true,
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
// 读写文件
|
|
51
|
+
const content = await readFile('./package.json', { encoding: 'utf8' })
|
|
52
|
+
await writeFile('./output.txt', 'hello world')
|
|
53
|
+
|
|
54
|
+
// 文件信息
|
|
55
|
+
const s = await stat('./package.json')
|
|
56
|
+
console.log(s.size, s.isFile())
|
|
57
|
+
|
|
58
|
+
// 创建目录
|
|
59
|
+
await mkdir('./new-dir', { recursive: true })
|
|
60
|
+
|
|
61
|
+
// 删除
|
|
62
|
+
await rm('./temp', { recursive: true, force: true })
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 性能基准
|
|
66
|
+
|
|
67
|
+
> 测试环境:Apple Silicon (arm64),Node.js 24.0.2,release 构建(开启 LTO)。
|
|
68
|
+
> 运行 `pnpm build && pnpm bench` 可复现。
|
|
69
|
+
|
|
70
|
+
### Rush-FS 显著更快的场景
|
|
71
|
+
|
|
72
|
+
这些场景中 Rust 的并行遍历和零拷贝 I/O 发挥了真正优势:
|
|
73
|
+
|
|
74
|
+
| 场景 | Node.js | Rush-FS | 加速比 |
|
|
75
|
+
| ------------------------------------------- | --------- | -------- | --------- |
|
|
76
|
+
| `readdir` 递归(node_modules,约 3 万条目) | 281 ms | 23 ms | **12x** |
|
|
77
|
+
| `glob` 递归(`**/*.rs`) | 25 ms | 1.46 ms | **17x** |
|
|
78
|
+
| `glob` 递归 vs fast-glob | 102 ms | 1.46 ms | **70x** |
|
|
79
|
+
| `copyFile` 4 MB | 4.67 ms | 0.09 ms | **50x** |
|
|
80
|
+
| `readFile` 4 MB utf8 | 1.86 ms | 0.92 ms | **2x** |
|
|
81
|
+
| `readFile` 64 KB utf8 | 42 µs | 18 µs | **2.4x** |
|
|
82
|
+
| `rm` 2000 个文件(4 线程) | 92 ms | 53 ms | **1.75x** |
|
|
83
|
+
| `access` R_OK(目录) | 4.18 µs | 1.55 µs | **2.7x** |
|
|
84
|
+
| `cp` 500 文件平铺目录(4 线程) | 86.45 ms | 32.88 ms | **2.6x** |
|
|
85
|
+
| `cp` 树形目录 ~363 节点(4 线程) | 108.73 ms | 46.88 ms | **2.3x** |
|
|
86
|
+
|
|
87
|
+
### 与 Node.js 持平的场景
|
|
88
|
+
|
|
89
|
+
单文件操作有约 0.3 µs 的 napi 桥接开销,整体表现基本一致:
|
|
90
|
+
|
|
91
|
+
| 场景 | Node.js | Rush-FS | 比率 |
|
|
92
|
+
| ---------------------------- | ------- | ------- | ---- |
|
|
93
|
+
| `stat`(单文件) | 1.45 µs | 1.77 µs | 1.2x |
|
|
94
|
+
| `readFile` 小文件(Buffer) | 8.86 µs | 9.46 µs | 1.1x |
|
|
95
|
+
| `writeFile` 小文件(string) | 74 µs | 66 µs | 0.9x |
|
|
96
|
+
| `writeFile` 小文件(Buffer) | 115 µs | 103 µs | 0.9x |
|
|
97
|
+
| `appendFile` | 30 µs | 27 µs | 0.9x |
|
|
98
|
+
|
|
99
|
+
### Node.js 更快的场景
|
|
100
|
+
|
|
101
|
+
极轻量级的内置调用,napi 开销占比较大:
|
|
102
|
+
|
|
103
|
+
| 场景 | Node.js | Rush-FS | 说明 |
|
|
104
|
+
| -------------------------- | ------- | ------- | ------------------------ |
|
|
105
|
+
| `existsSync`(已存在文件) | 444 ns | 1.34 µs | Node.js 内部有 fast path |
|
|
106
|
+
| `accessSync` F_OK | 456 ns | 1.46 µs | 同上——napi 开销占主导 |
|
|
107
|
+
| `writeFile` 4 MB string | 2.93 ms | 5.69 ms | 大字符串跨 napi 桥传输 |
|
|
108
|
+
|
|
109
|
+
### 并行支持
|
|
110
|
+
|
|
111
|
+
Rush-FS 在文件系统遍历类操作中使用多线程并行:
|
|
112
|
+
|
|
113
|
+
| API | 并行库 | `concurrency` 选项 | 默认值 |
|
|
114
|
+
| ----------------- | ------------------------------------------------------------------------- | ------------------ | ------ |
|
|
115
|
+
| `readdir`(递归) | [jwalk](https://github.com/Byron/jwalk) | ✅ | auto |
|
|
116
|
+
| `glob` | [ignore](https://github.com/BurntSushi/ripgrep/tree/master/crates/ignore) | ✅ | 4 |
|
|
117
|
+
| `rm`(递归) | [rayon](https://github.com/rayon-rs/rayon) | ✅ | 1 |
|
|
118
|
+
| `cp`(递归) | [rayon](https://github.com/rayon-rs/rayon) | ✅ | 1 |
|
|
119
|
+
|
|
120
|
+
单文件操作(`stat`、`readFile`、`writeFile`、`chmod` 等)是原子系统调用,不适用并行化。
|
|
121
|
+
|
|
122
|
+
### 核心结论
|
|
123
|
+
|
|
124
|
+
**Rush-FS 在递归/批量文件系统操作上表现卓越**(readdir、glob、rm、cp),Rust 的并行遍历器带来 2–70 倍加速。单文件操作与 Node.js 基本持平。napi 桥接带来固定约 0.3 µs 的每次调用开销,仅在亚微秒级操作(如 `existsSync`)中有感知。
|
|
125
|
+
|
|
126
|
+
**`cp` 基准详情**(Apple Silicon,release 构建):
|
|
127
|
+
|
|
128
|
+
| 场景 | Node.js | Rush-FS 1 线程 | Rush-FS 4 线程 | Rush-FS 8 线程 |
|
|
129
|
+
| ------------------------------------- | --------- | -------------- | -------------- | -------------- |
|
|
130
|
+
| 平铺目录(500 文件) | 86.45 ms | 61.56 ms | 32.88 ms | 36.67 ms |
|
|
131
|
+
| 树形目录(宽度=4,深度=3,~84 节点) | 23.80 ms | 16.94 ms | 10.62 ms | 9.76 ms |
|
|
132
|
+
| 树形目录(宽度=3,深度=5,~363 节点) | 108.73 ms | 75.39 ms | 46.88 ms | 46.18 ms |
|
|
133
|
+
|
|
134
|
+
`cp` 的最优并发数在 Apple Silicon 上为 **4 线程**——超过后受 I/O 带宽限制,收益趋于平稳。
|
|
135
|
+
|
|
136
|
+
## 工作原理
|
|
137
|
+
|
|
138
|
+
Node.js 原生的 fs 在底层串行执行,且需要较多内存将系统对象与字符串解析为 JS 形式:
|
|
139
|
+
|
|
140
|
+
```mermaid
|
|
141
|
+
graph TD
|
|
142
|
+
A["JS: readdir"] -->|Call| B("Node.js C++ Binding")
|
|
143
|
+
B -->|Submit Task| C{"Libuv Thread Pool"}
|
|
144
|
+
|
|
145
|
+
subgraph "Native Layer (Serial)"
|
|
146
|
+
C -->|"Syscall: getdents"| D[OS Kernel]
|
|
147
|
+
D -->|"Return File List"| C
|
|
148
|
+
C -->|"Process Paths"| C
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
C -->|"Results Ready"| E("V8 Main Thread")
|
|
152
|
+
|
|
153
|
+
subgraph "V8 Interaction (Heavy)"
|
|
154
|
+
E -->|"Create JS String 1"| F[V8 Heap]
|
|
155
|
+
E -->|"String 2"| F
|
|
156
|
+
E -->|"String N..."| F
|
|
157
|
+
F -->|"GC Pressure Rising"| F
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
E -->|"Return Array"| G["JS Callback/Promise"]
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Rust 实现则把重计算放在 Rust 侧,减少与 V8 的交互与 GC 压力:
|
|
164
|
+
|
|
165
|
+
```mermaid
|
|
166
|
+
graph TD
|
|
167
|
+
A["JS: readdir"] -->|"N-API Call"| B("Rust Wrapper")
|
|
168
|
+
B -->|"Spawn Thread/Task"| C{"Rust Thread Pool"}
|
|
169
|
+
|
|
170
|
+
subgraph "Rust 'Black Box'"
|
|
171
|
+
C -->|"Rayon: Parallel work"| D[OS Kernel]
|
|
172
|
+
D -->|"Syscall: getdents"| C
|
|
173
|
+
C -->|"Store as Rust Vec<String>"| H[Rust Heap]
|
|
174
|
+
H -->|"No V8 Interaction yet"| H
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
C -->|"All Done"| I("Convert to JS")
|
|
178
|
+
|
|
179
|
+
subgraph "N-API Bridge"
|
|
180
|
+
I -->|"Batch Create JS Array"| J[V8 Heap]
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
J -->|Return| K["JS Result"]
|
|
184
|
+
```
|
|
185
|
+
|
|
26
186
|
## 状态与路线图
|
|
27
187
|
|
|
28
188
|
我们正在逐个重写 `fs` 的 API。
|
|
@@ -314,140 +474,23 @@ pnpm add rush-fs
|
|
|
314
474
|
|
|
315
475
|
- **状态**:❌
|
|
316
476
|
|
|
317
|
-
##
|
|
318
|
-
|
|
319
|
-
```ts
|
|
320
|
-
import { readdir, stat, readFile, writeFile, mkdir, rm } from 'rush-fs'
|
|
321
|
-
|
|
322
|
-
// 读取目录
|
|
323
|
-
const files = await readdir('./src')
|
|
324
|
-
|
|
325
|
-
// 递归 + 返回文件类型
|
|
326
|
-
const entries = await readdir('./src', {
|
|
327
|
-
recursive: true,
|
|
328
|
-
withFileTypes: true,
|
|
329
|
-
})
|
|
330
|
-
|
|
331
|
-
// 读写文件
|
|
332
|
-
const content = await readFile('./package.json', { encoding: 'utf8' })
|
|
333
|
-
await writeFile('./output.txt', 'hello world')
|
|
334
|
-
|
|
335
|
-
// 文件信息
|
|
336
|
-
const s = await stat('./package.json')
|
|
337
|
-
console.log(s.size, s.isFile())
|
|
338
|
-
|
|
339
|
-
// 创建目录
|
|
340
|
-
await mkdir('./new-dir', { recursive: true })
|
|
341
|
-
|
|
342
|
-
// 删除
|
|
343
|
-
await rm('./temp', { recursive: true, force: true })
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
## 性能基准
|
|
347
|
-
|
|
348
|
-
> 测试环境:Apple Silicon (arm64),Node.js 24.0.2,release 构建(开启 LTO)。
|
|
349
|
-
> 运行 `pnpm build && pnpm bench` 可复现。
|
|
350
|
-
|
|
351
|
-
### Rush-FS 显著更快的场景
|
|
352
|
-
|
|
353
|
-
这些场景中 Rust 的并行遍历和零拷贝 I/O 发挥了真正优势:
|
|
354
|
-
|
|
355
|
-
| 场景 | Node.js | Rush-FS | 加速比 |
|
|
356
|
-
| ------------------------------------------- | --------- | -------- | --------- |
|
|
357
|
-
| `readdir` 递归(node_modules,约 3 万条目) | 281 ms | 23 ms | **12x** |
|
|
358
|
-
| `glob` 递归(`**/*.rs`) | 25 ms | 1.46 ms | **17x** |
|
|
359
|
-
| `glob` 递归 vs fast-glob | 102 ms | 1.46 ms | **70x** |
|
|
360
|
-
| `copyFile` 4 MB | 4.67 ms | 0.09 ms | **50x** |
|
|
361
|
-
| `readFile` 4 MB utf8 | 1.86 ms | 0.92 ms | **2x** |
|
|
362
|
-
| `readFile` 64 KB utf8 | 42 µs | 18 µs | **2.4x** |
|
|
363
|
-
| `rm` 2000 个文件(4 线程) | 92 ms | 53 ms | **1.75x** |
|
|
364
|
-
| `access` R_OK(目录) | 4.18 µs | 1.55 µs | **2.7x** |
|
|
365
|
-
| `cp` 500 文件平铺目录(4 线程) | 86.45 ms | 32.88 ms | **2.6x** |
|
|
366
|
-
| `cp` 树形目录 ~363 节点(4 线程) | 108.73 ms | 46.88 ms | **2.3x** |
|
|
367
|
-
|
|
368
|
-
### 与 Node.js 持平的场景
|
|
369
|
-
|
|
370
|
-
单文件操作有约 0.3 µs 的 napi 桥接开销,整体表现基本一致:
|
|
371
|
-
|
|
372
|
-
| 场景 | Node.js | Rush-FS | 比率 |
|
|
373
|
-
| ---------------------------- | ------- | ------- | ---- |
|
|
374
|
-
| `stat`(单文件) | 1.45 µs | 1.77 µs | 1.2x |
|
|
375
|
-
| `readFile` 小文件(Buffer) | 8.86 µs | 9.46 µs | 1.1x |
|
|
376
|
-
| `writeFile` 小文件(string) | 74 µs | 66 µs | 0.9x |
|
|
377
|
-
| `writeFile` 小文件(Buffer) | 115 µs | 103 µs | 0.9x |
|
|
378
|
-
| `appendFile` | 30 µs | 27 µs | 0.9x |
|
|
379
|
-
|
|
380
|
-
### Node.js 更快的场景
|
|
381
|
-
|
|
382
|
-
极轻量级的内置调用,napi 开销占比较大:
|
|
383
|
-
|
|
384
|
-
| 场景 | Node.js | Rush-FS | 说明 |
|
|
385
|
-
| -------------------------- | ------- | ------- | ------------------------ |
|
|
386
|
-
| `existsSync`(已存在文件) | 444 ns | 1.34 µs | Node.js 内部有 fast path |
|
|
387
|
-
| `accessSync` F_OK | 456 ns | 1.46 µs | 同上——napi 开销占主导 |
|
|
388
|
-
| `writeFile` 4 MB string | 2.93 ms | 5.69 ms | 大字符串跨 napi 桥传输 |
|
|
389
|
-
|
|
390
|
-
### 并行支持
|
|
391
|
-
|
|
392
|
-
Rush-FS 在文件系统遍历类操作中使用多线程并行:
|
|
393
|
-
|
|
394
|
-
| API | 并行库 | `concurrency` 选项 | 默认值 |
|
|
395
|
-
| ----------------- | ------------------------------------------------------------------------- | ------------------ | ------ |
|
|
396
|
-
| `readdir`(递归) | [jwalk](https://github.com/Byron/jwalk) | ✅ | auto |
|
|
397
|
-
| `glob` | [ignore](https://github.com/BurntSushi/ripgrep/tree/master/crates/ignore) | ✅ | 4 |
|
|
398
|
-
| `rm`(递归) | [rayon](https://github.com/rayon-rs/rayon) | ✅ | 1 |
|
|
399
|
-
| `cp`(递归) | [rayon](https://github.com/rayon-rs/rayon) | ✅ | 1 |
|
|
400
|
-
|
|
401
|
-
单文件操作(`stat`、`readFile`、`writeFile`、`chmod` 等)是原子系统调用,不适用并行化。
|
|
402
|
-
|
|
403
|
-
### 核心结论
|
|
404
|
-
|
|
405
|
-
**Rush-FS 在递归/批量文件系统操作上表现卓越**(readdir、glob、rm、cp),Rust 的并行遍历器带来 2–70 倍加速。单文件操作与 Node.js 基本持平。napi 桥接带来固定约 0.3 µs 的每次调用开销,仅在亚微秒级操作(如 `existsSync`)中有感知。
|
|
406
|
-
|
|
407
|
-
**`cp` 基准详情**(Apple Silicon,release 构建):
|
|
408
|
-
|
|
409
|
-
| 场景 | Node.js | Rush-FS 1 线程 | Rush-FS 4 线程 | Rush-FS 8 线程 |
|
|
410
|
-
| ------------------------------------- | --------- | -------------- | -------------- | -------------- |
|
|
411
|
-
| 平铺目录(500 文件) | 86.45 ms | 61.56 ms | 32.88 ms | 36.67 ms |
|
|
412
|
-
| 树形目录(宽度=4,深度=3,~84 节点) | 23.80 ms | 16.94 ms | 10.62 ms | 9.76 ms |
|
|
413
|
-
| 树形目录(宽度=3,深度=5,~363 节点) | 108.73 ms | 75.39 ms | 46.88 ms | 46.18 ms |
|
|
477
|
+
## 更新日志
|
|
414
478
|
|
|
415
|
-
|
|
479
|
+
各版本变更见 [CHANGELOG.md](./CHANGELOG.md)。发布 tag 列表见 [GitHub Releases](https://github.com/CoderSerio/rush-fs/releases)。
|
|
416
480
|
|
|
417
481
|
## 贡献
|
|
418
482
|
|
|
419
|
-
参阅 [CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
483
|
+
参阅 [CONTRIBUTING-CN.md](./CONTRIBUTING-CN.md) 获取完整开发指南:环境搭建、参考 Node.js 源码、编写 Rust 实现、测试与性能基准。
|
|
420
484
|
|
|
421
485
|
## 发布(维护者专用)
|
|
422
486
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
### 通过 GitHub Actions 发布(推荐)
|
|
426
|
-
|
|
427
|
-
CI 已在多平台(macOS x64/arm64、Windows、Linux)构建并测试,通过后可由同一 workflow 发布到 npm。
|
|
428
|
-
|
|
429
|
-
1. 在仓库 **Settings → Secrets and variables → Actions** 里添加 **NPM_TOKEN**(npm 账号生成的 Classic Token,需允许发布)。
|
|
430
|
-
2. 确保 `package.json` 和 `Cargo.toml` 中版本号一致(如 `0.0.3`),且 `package.json` 里已包含四个 `optionalDependencies`(版本与主包一致)。
|
|
431
|
-
3. 提交并推送到 `main`,**且该次提交的 commit message 仅为版本号**(如 `0.0.3`)。CI 跑通后会自动:先发布四个平台包,再发布主包 `rush-fs`。
|
|
432
|
-
|
|
433
|
-
示例:
|
|
434
|
-
|
|
435
|
-
```bash
|
|
436
|
-
# 版本和 optionalDependencies 已改好后
|
|
437
|
-
git add package.json Cargo.toml
|
|
438
|
-
git commit -m "0.0.3"
|
|
439
|
-
git push origin main
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
4. 发版完成后,若希望 CI 继续用 `pnpm install --frozen-lockfile`,可在仓库里删掉 `optionalDependencies` 再提交,下次发版前再加回。
|
|
443
|
-
|
|
444
|
-
### 本地发布(需能构建各平台)
|
|
487
|
+
发布由 [Release 工作流](.github/workflows/Release.yml) 完成:在 macOS(x64/arm64)、Windows、Linux 上构建原生二进制,并发布各平台包与主包到 npm。
|
|
445
488
|
|
|
446
|
-
|
|
489
|
+
1. **Secrets:** 在仓库 **Settings → Secrets and variables → Actions** 中添加 **NPM_TOKEN**(npm Classic 或 Automation token,需具备 Publish 权限)。
|
|
490
|
+
2. **发布:** 在 **Actions → Release → Run workflow** 中手动运行(使用当前 `main` 上的 `package.json` 版本),或先更新 `package.json` 与 `Cargo.toml` 中的版本号并推送到 `main`,再创建并推送 tag:`git tag v<版本号> && git push origin v<版本号>`。
|
|
491
|
+
3. **更新日志:** 发布前或发布后更新 [CHANGELOG.md](./CHANGELOG.md)(将 `[Unreleased]` 下的条目移到新版本标题下并补充 compare 链接)。
|
|
447
492
|
|
|
448
|
-
|
|
449
|
-
2. 使用 `pnpm version <patch|minor|major>` 提升版本号(会执行 `pnpm preversion` 在 `npm/` 下构建)。
|
|
450
|
-
3. 运行 `pnpm prepublishOnly` 发布各平台包,再执行 `pnpm publish --access public` 发布主包。
|
|
493
|
+
工作流会自动注入 `optionalDependencies` 并发布所有包,无需在 `package.json` 中手动填写。
|
|
451
494
|
|
|
452
495
|
## 许可证
|
|
453
496
|
|
package/index.js
CHANGED
|
@@ -75,10 +75,10 @@ function requireNative() {
|
|
|
75
75
|
loadErrors.push(e)
|
|
76
76
|
}
|
|
77
77
|
try {
|
|
78
|
-
const binding = require('rush-fs-android-arm64')
|
|
79
|
-
const bindingPackageVersion = require('rush-fs-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.0.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
78
|
+
const binding = require('@rush-fs/rush-fs-android-arm64')
|
|
79
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-android-arm64/package.json').version
|
|
80
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -91,10 +91,10 @@ function requireNative() {
|
|
|
91
91
|
loadErrors.push(e)
|
|
92
92
|
}
|
|
93
93
|
try {
|
|
94
|
-
const binding = require('rush-fs-android-arm-eabi')
|
|
95
|
-
const bindingPackageVersion = require('rush-fs-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.0.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
94
|
+
const binding = require('@rush-fs/rush-fs-android-arm-eabi')
|
|
95
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-android-arm-eabi/package.json').version
|
|
96
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -112,10 +112,10 @@ function requireNative() {
|
|
|
112
112
|
loadErrors.push(e)
|
|
113
113
|
}
|
|
114
114
|
try {
|
|
115
|
-
const binding = require('rush-fs-win32-x64-gnu')
|
|
116
|
-
const bindingPackageVersion = require('rush-fs-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.0.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
115
|
+
const binding = require('@rush-fs/rush-fs-win32-x64-gnu')
|
|
116
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-win32-x64-gnu/package.json').version
|
|
117
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -128,10 +128,10 @@ function requireNative() {
|
|
|
128
128
|
loadErrors.push(e)
|
|
129
129
|
}
|
|
130
130
|
try {
|
|
131
|
-
const binding = require('rush-fs-win32-x64-msvc')
|
|
132
|
-
const bindingPackageVersion = require('rush-fs-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.0.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
131
|
+
const binding = require('@rush-fs/rush-fs-win32-x64-msvc')
|
|
132
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-win32-x64-msvc/package.json').version
|
|
133
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -145,10 +145,10 @@ function requireNative() {
|
|
|
145
145
|
loadErrors.push(e)
|
|
146
146
|
}
|
|
147
147
|
try {
|
|
148
|
-
const binding = require('rush-fs-win32-ia32-msvc')
|
|
149
|
-
const bindingPackageVersion = require('rush-fs-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.0.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
148
|
+
const binding = require('@rush-fs/rush-fs-win32-ia32-msvc')
|
|
149
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-win32-ia32-msvc/package.json').version
|
|
150
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -161,10 +161,10 @@ function requireNative() {
|
|
|
161
161
|
loadErrors.push(e)
|
|
162
162
|
}
|
|
163
163
|
try {
|
|
164
|
-
const binding = require('rush-fs-win32-arm64-msvc')
|
|
165
|
-
const bindingPackageVersion = require('rush-fs-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.0.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
164
|
+
const binding = require('@rush-fs/rush-fs-win32-arm64-msvc')
|
|
165
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-win32-arm64-msvc/package.json').version
|
|
166
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -180,10 +180,10 @@ function requireNative() {
|
|
|
180
180
|
loadErrors.push(e)
|
|
181
181
|
}
|
|
182
182
|
try {
|
|
183
|
-
const binding = require('rush-fs-darwin-universal')
|
|
184
|
-
const bindingPackageVersion = require('rush-fs-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.0.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
183
|
+
const binding = require('@rush-fs/rush-fs-darwin-universal')
|
|
184
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-darwin-universal/package.json').version
|
|
185
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -196,10 +196,10 @@ function requireNative() {
|
|
|
196
196
|
loadErrors.push(e)
|
|
197
197
|
}
|
|
198
198
|
try {
|
|
199
|
-
const binding = require('rush-fs-darwin-x64')
|
|
200
|
-
const bindingPackageVersion = require('rush-fs-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.0.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
199
|
+
const binding = require('@rush-fs/rush-fs-darwin-x64')
|
|
200
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-darwin-x64/package.json').version
|
|
201
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -212,10 +212,10 @@ function requireNative() {
|
|
|
212
212
|
loadErrors.push(e)
|
|
213
213
|
}
|
|
214
214
|
try {
|
|
215
|
-
const binding = require('rush-fs-darwin-arm64')
|
|
216
|
-
const bindingPackageVersion = require('rush-fs-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.0.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
215
|
+
const binding = require('@rush-fs/rush-fs-darwin-arm64')
|
|
216
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-darwin-arm64/package.json').version
|
|
217
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -232,10 +232,10 @@ function requireNative() {
|
|
|
232
232
|
loadErrors.push(e)
|
|
233
233
|
}
|
|
234
234
|
try {
|
|
235
|
-
const binding = require('rush-fs-freebsd-x64')
|
|
236
|
-
const bindingPackageVersion = require('rush-fs-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.0.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
235
|
+
const binding = require('@rush-fs/rush-fs-freebsd-x64')
|
|
236
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-freebsd-x64/package.json').version
|
|
237
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -248,10 +248,10 @@ function requireNative() {
|
|
|
248
248
|
loadErrors.push(e)
|
|
249
249
|
}
|
|
250
250
|
try {
|
|
251
|
-
const binding = require('rush-fs-freebsd-arm64')
|
|
252
|
-
const bindingPackageVersion = require('rush-fs-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.0.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
251
|
+
const binding = require('@rush-fs/rush-fs-freebsd-arm64')
|
|
252
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-freebsd-arm64/package.json').version
|
|
253
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -269,10 +269,10 @@ function requireNative() {
|
|
|
269
269
|
loadErrors.push(e)
|
|
270
270
|
}
|
|
271
271
|
try {
|
|
272
|
-
const binding = require('rush-fs-linux-x64-musl')
|
|
273
|
-
const bindingPackageVersion = require('rush-fs-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.0.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
272
|
+
const binding = require('@rush-fs/rush-fs-linux-x64-musl')
|
|
273
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-linux-x64-musl/package.json').version
|
|
274
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -285,10 +285,10 @@ function requireNative() {
|
|
|
285
285
|
loadErrors.push(e)
|
|
286
286
|
}
|
|
287
287
|
try {
|
|
288
|
-
const binding = require('rush-fs-linux-x64-gnu')
|
|
289
|
-
const bindingPackageVersion = require('rush-fs-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.0.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
288
|
+
const binding = require('@rush-fs/rush-fs-linux-x64-gnu')
|
|
289
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-linux-x64-gnu/package.json').version
|
|
290
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -303,10 +303,10 @@ function requireNative() {
|
|
|
303
303
|
loadErrors.push(e)
|
|
304
304
|
}
|
|
305
305
|
try {
|
|
306
|
-
const binding = require('rush-fs-linux-arm64-musl')
|
|
307
|
-
const bindingPackageVersion = require('rush-fs-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.0.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
306
|
+
const binding = require('@rush-fs/rush-fs-linux-arm64-musl')
|
|
307
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-linux-arm64-musl/package.json').version
|
|
308
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -319,10 +319,10 @@ function requireNative() {
|
|
|
319
319
|
loadErrors.push(e)
|
|
320
320
|
}
|
|
321
321
|
try {
|
|
322
|
-
const binding = require('rush-fs-linux-arm64-gnu')
|
|
323
|
-
const bindingPackageVersion = require('rush-fs-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.0.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
322
|
+
const binding = require('@rush-fs/rush-fs-linux-arm64-gnu')
|
|
323
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-linux-arm64-gnu/package.json').version
|
|
324
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -337,10 +337,10 @@ function requireNative() {
|
|
|
337
337
|
loadErrors.push(e)
|
|
338
338
|
}
|
|
339
339
|
try {
|
|
340
|
-
const binding = require('rush-fs-linux-arm-musleabihf')
|
|
341
|
-
const bindingPackageVersion = require('rush-fs-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.0.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
340
|
+
const binding = require('@rush-fs/rush-fs-linux-arm-musleabihf')
|
|
341
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-linux-arm-musleabihf/package.json').version
|
|
342
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -353,10 +353,10 @@ function requireNative() {
|
|
|
353
353
|
loadErrors.push(e)
|
|
354
354
|
}
|
|
355
355
|
try {
|
|
356
|
-
const binding = require('rush-fs-linux-arm-gnueabihf')
|
|
357
|
-
const bindingPackageVersion = require('rush-fs-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.0.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
356
|
+
const binding = require('@rush-fs/rush-fs-linux-arm-gnueabihf')
|
|
357
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-linux-arm-gnueabihf/package.json').version
|
|
358
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -371,10 +371,10 @@ function requireNative() {
|
|
|
371
371
|
loadErrors.push(e)
|
|
372
372
|
}
|
|
373
373
|
try {
|
|
374
|
-
const binding = require('rush-fs-linux-loong64-musl')
|
|
375
|
-
const bindingPackageVersion = require('rush-fs-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.0.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
374
|
+
const binding = require('@rush-fs/rush-fs-linux-loong64-musl')
|
|
375
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-linux-loong64-musl/package.json').version
|
|
376
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -387,10 +387,10 @@ function requireNative() {
|
|
|
387
387
|
loadErrors.push(e)
|
|
388
388
|
}
|
|
389
389
|
try {
|
|
390
|
-
const binding = require('rush-fs-linux-loong64-gnu')
|
|
391
|
-
const bindingPackageVersion = require('rush-fs-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.0.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
390
|
+
const binding = require('@rush-fs/rush-fs-linux-loong64-gnu')
|
|
391
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-linux-loong64-gnu/package.json').version
|
|
392
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -405,10 +405,10 @@ function requireNative() {
|
|
|
405
405
|
loadErrors.push(e)
|
|
406
406
|
}
|
|
407
407
|
try {
|
|
408
|
-
const binding = require('rush-fs-linux-riscv64-musl')
|
|
409
|
-
const bindingPackageVersion = require('rush-fs-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.0.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
408
|
+
const binding = require('@rush-fs/rush-fs-linux-riscv64-musl')
|
|
409
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-linux-riscv64-musl/package.json').version
|
|
410
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -421,10 +421,10 @@ function requireNative() {
|
|
|
421
421
|
loadErrors.push(e)
|
|
422
422
|
}
|
|
423
423
|
try {
|
|
424
|
-
const binding = require('rush-fs-linux-riscv64-gnu')
|
|
425
|
-
const bindingPackageVersion = require('rush-fs-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.0.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
424
|
+
const binding = require('@rush-fs/rush-fs-linux-riscv64-gnu')
|
|
425
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-linux-riscv64-gnu/package.json').version
|
|
426
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -438,10 +438,10 @@ function requireNative() {
|
|
|
438
438
|
loadErrors.push(e)
|
|
439
439
|
}
|
|
440
440
|
try {
|
|
441
|
-
const binding = require('rush-fs-linux-ppc64-gnu')
|
|
442
|
-
const bindingPackageVersion = require('rush-fs-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.0.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
441
|
+
const binding = require('@rush-fs/rush-fs-linux-ppc64-gnu')
|
|
442
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-linux-ppc64-gnu/package.json').version
|
|
443
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -454,10 +454,10 @@ function requireNative() {
|
|
|
454
454
|
loadErrors.push(e)
|
|
455
455
|
}
|
|
456
456
|
try {
|
|
457
|
-
const binding = require('rush-fs-linux-s390x-gnu')
|
|
458
|
-
const bindingPackageVersion = require('rush-fs-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.0.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
457
|
+
const binding = require('@rush-fs/rush-fs-linux-s390x-gnu')
|
|
458
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-linux-s390x-gnu/package.json').version
|
|
459
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -474,10 +474,10 @@ function requireNative() {
|
|
|
474
474
|
loadErrors.push(e)
|
|
475
475
|
}
|
|
476
476
|
try {
|
|
477
|
-
const binding = require('rush-fs-openharmony-arm64')
|
|
478
|
-
const bindingPackageVersion = require('rush-fs-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.0.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
477
|
+
const binding = require('@rush-fs/rush-fs-openharmony-arm64')
|
|
478
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-openharmony-arm64/package.json').version
|
|
479
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -490,10 +490,10 @@ function requireNative() {
|
|
|
490
490
|
loadErrors.push(e)
|
|
491
491
|
}
|
|
492
492
|
try {
|
|
493
|
-
const binding = require('rush-fs-openharmony-x64')
|
|
494
|
-
const bindingPackageVersion = require('rush-fs-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.0.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
493
|
+
const binding = require('@rush-fs/rush-fs-openharmony-x64')
|
|
494
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-openharmony-x64/package.json').version
|
|
495
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -506,10 +506,10 @@ function requireNative() {
|
|
|
506
506
|
loadErrors.push(e)
|
|
507
507
|
}
|
|
508
508
|
try {
|
|
509
|
-
const binding = require('rush-fs-openharmony-arm')
|
|
510
|
-
const bindingPackageVersion = require('rush-fs-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.0.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.0.
|
|
509
|
+
const binding = require('@rush-fs/rush-fs-openharmony-arm')
|
|
510
|
+
const bindingPackageVersion = require('@rush-fs/rush-fs-openharmony-arm/package.json').version
|
|
511
|
+
if (bindingPackageVersion !== '0.0.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.0.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -538,7 +538,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
|
538
538
|
}
|
|
539
539
|
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
540
540
|
try {
|
|
541
|
-
wasiBinding = require('rush-fs-wasm32-wasi')
|
|
541
|
+
wasiBinding = require('@rush-fs/rush-fs-wasm32-wasi')
|
|
542
542
|
nativeBinding = wasiBinding
|
|
543
543
|
} catch (err) {
|
|
544
544
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rush-fs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "High-performance drop-in replacement for Node.js fs module, powered by Rust",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -46,6 +46,9 @@
|
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"artifacts": "napi artifacts",
|
|
49
|
+
"doc:dev": "pnpm -C docs dev",
|
|
50
|
+
"doc:build": "pnpm -C docs build",
|
|
51
|
+
"doc:start": "pnpm -C docs start",
|
|
49
52
|
"bench": "node --import @oxc-node/core/register benchmark/bench.ts",
|
|
50
53
|
"build": "napi build --platform --release",
|
|
51
54
|
"build:debug": "napi build --platform",
|
|
@@ -115,9 +118,9 @@
|
|
|
115
118
|
},
|
|
116
119
|
"packageManager": "pnpm@9.15.4",
|
|
117
120
|
"optionalDependencies": {
|
|
118
|
-
"rush-fs-win32-x64-msvc": "0.0.
|
|
119
|
-
"rush-fs-darwin-x64": "0.0.
|
|
120
|
-
"rush-fs-linux-x64-gnu": "0.0.
|
|
121
|
-
"rush-fs-darwin-arm64": "0.0.
|
|
121
|
+
"rush-fs-win32-x64-msvc": "0.0.5",
|
|
122
|
+
"rush-fs-darwin-x64": "0.0.5",
|
|
123
|
+
"rush-fs-linux-x64-gnu": "0.0.5",
|
|
124
|
+
"rush-fs-darwin-arm64": "0.0.5"
|
|
122
125
|
}
|
|
123
126
|
}
|