exarch-rs 0.4.0 → 0.5.0
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 +30 -2
- package/index.d.ts +789 -0
- package/native/exarch-rs.darwin-arm64.node +0 -0
- package/native/exarch-rs.darwin-x64.node +0 -0
- package/native/exarch-rs.linux-arm64-gnu.node +0 -0
- package/native/exarch-rs.linux-x64-gnu.node +0 -0
- package/native/exarch-rs.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
- package/src/config.rs +192 -2
- package/src/error.rs +104 -15
- package/src/lib.rs +235 -27
- package/tests/extraction-options.test.js +133 -0
- package/tests/security-config.test.js +13 -0
package/README.md
CHANGED
|
@@ -161,6 +161,34 @@ interface ExtractionReport {
|
|
|
161
161
|
}
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
+
### `extractArchiveWithProgress(archivePath, outputDir, config?, progress?)`
|
|
165
|
+
|
|
166
|
+
Async extraction with an optional progress callback.
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
import { extractArchiveWithProgress } from 'exarch-rs';
|
|
170
|
+
|
|
171
|
+
const result = await extractArchiveWithProgress(
|
|
172
|
+
'archive.tar.gz',
|
|
173
|
+
'/output/path',
|
|
174
|
+
undefined, // SecurityConfig or undefined
|
|
175
|
+
(path, total, current, bytesWritten) => {
|
|
176
|
+
console.log(`[${current}/${total}] ${path} (${bytesWritten} bytes)`);
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Parameters:**
|
|
182
|
+
|
|
183
|
+
| Name | Type | Description |
|
|
184
|
+
|------|------|-------------|
|
|
185
|
+
| `archivePath` | `string` | Path to the archive file |
|
|
186
|
+
| `outputDir` | `string` | Directory where files will be extracted |
|
|
187
|
+
| `config` | `SecurityConfig \| undefined` | Optional security configuration |
|
|
188
|
+
| `progress` | `(path: string, total: bigint, current: bigint, bytesWritten: bigint) => void \| undefined` | Optional progress callback |
|
|
189
|
+
|
|
190
|
+
**Returns:** `Promise<ExtractionReport>`
|
|
191
|
+
|
|
164
192
|
### `SecurityConfig`
|
|
165
193
|
|
|
166
194
|
Builder-style security configuration.
|
|
@@ -176,6 +204,8 @@ const config = new SecurityConfig()
|
|
|
176
204
|
.setAllowSolidArchives(true); // Allow solid 7z archives (default: false)
|
|
177
205
|
```
|
|
178
206
|
|
|
207
|
+
**Getters:** `allowSymlinks`, `allowHardlinks`, `allowAbsolutePaths`, `allowWorldWritable`, `allowSolidArchives` — each returns the corresponding boolean policy value.
|
|
208
|
+
|
|
179
209
|
## Security Features
|
|
180
210
|
|
|
181
211
|
The library provides built-in protection against:
|
|
@@ -205,8 +235,6 @@ The library provides built-in protection against:
|
|
|
205
235
|
|
|
206
236
|
**Note:** 7z creation is not yet supported. Solid and encrypted 7z archives are rejected for security reasons. Unix symlinks inside 7z archives are reported as regular files (sevenz-rust2 API limitation).
|
|
207
237
|
|
|
208
|
-
**Note:** Since v0.4.0, partial extraction failures return the `ExtractionReport` accumulated up to the failure point without the inner error text being duplicated, and the report is now correctly delivered across the FFI boundary instead of being dropped early.
|
|
209
|
-
|
|
210
238
|
## Comparison with tar-fs
|
|
211
239
|
|
|
212
240
|
```javascript
|