@gjsify/tar 0.4.43 → 0.4.44
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 +34 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @gjsify/tar
|
|
2
|
+
|
|
3
|
+
Node-free `.tar` / `.tar.gz` reader and writer used by `gjsify install` to unpack npm tarballs on GJS. Decompression uses the Web Compression API (`DecompressionStream`); extraction writes via `node:fs` (polyfilled by `@gjsify/fs` on GJS). Runs on both Node.js and GJS.
|
|
4
|
+
|
|
5
|
+
Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gjsify install @gjsify/tar
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { extractTarball, parseTar, createTarball } from '@gjsify/tar';
|
|
17
|
+
|
|
18
|
+
// Extract a .tgz buffer (e.g. a downloaded npm tarball) into a directory
|
|
19
|
+
const tgzBuffer = await fetch('https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz')
|
|
20
|
+
.then(r => r.arrayBuffer());
|
|
21
|
+
|
|
22
|
+
const result = await extractTarball(tgzBuffer, '/tmp/lodash', { strip: 1 });
|
|
23
|
+
console.log(result.files); // list of extracted file paths
|
|
24
|
+
console.log(result.symlinks); // list of created symlinks
|
|
25
|
+
|
|
26
|
+
// Parse individual tar entries without writing to disk
|
|
27
|
+
for (const entry of parseTar(tarBytes)) {
|
|
28
|
+
console.log(entry.name, entry.type, entry.size);
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/tar",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.44",
|
|
4
4
|
"description": "Streaming .tar / .tar.gz reader for the gjsify install backend (Node + GJS)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
],
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@gjsify/cli": "^0.4.
|
|
41
|
-
"@gjsify/compression-streams": "^0.4.
|
|
42
|
-
"@gjsify/unit": "^0.4.
|
|
40
|
+
"@gjsify/cli": "^0.4.44",
|
|
41
|
+
"@gjsify/compression-streams": "^0.4.44",
|
|
42
|
+
"@gjsify/unit": "^0.4.44",
|
|
43
43
|
"typescript": "^6.0.3"
|
|
44
44
|
},
|
|
45
45
|
"repository": {
|