@vltpkg/tar 0.0.0-3 → 0.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 +34 -36
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,26 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
# @vltpkg/tar
|
|
4
4
|
|
|
5
|
-
A library for unpacking JavaScript package tarballs (gzip-compressed
|
|
5
|
+
A library for unpacking JavaScript package tarballs (gzip-compressed
|
|
6
|
+
or raw) into a specified folder.
|
|
6
7
|
|
|
7
|
-
**[Usage](#usage)**
|
|
8
|
-
·
|
|
9
|
-
**[Caveats](#caveats)**
|
|
8
|
+
**[Usage](#usage)** · **[Caveats](#caveats)**
|
|
10
9
|
|
|
11
10
|
## Overview
|
|
12
11
|
|
|
13
|
-
If you are unpacking anything other than npm packages, in precisely
|
|
14
|
-
|
|
12
|
+
If you are unpacking anything other than npm packages, in precisely
|
|
13
|
+
the way that [vlt](https://vlt.sh) does, then this is probably not
|
|
14
|
+
what you're looking for.
|
|
15
15
|
|
|
16
|
-
For a very complete and battle-tested generic tar implementation in
|
|
16
|
+
For a very complete and battle-tested generic tar implementation in
|
|
17
|
+
JavaScript, see [node-tar](http://npm.im/tar).
|
|
17
18
|
|
|
18
19
|
## Usage
|
|
19
20
|
|
|
20
21
|
### unpack(tarData, targetFolder)
|
|
21
22
|
|
|
22
23
|
Pass your gzip-compressed or raw uncompressed JavaScript package
|
|
23
|
-
tarball in a Buffer (or Uint8Array, or ArrayBuffer slice) into
|
|
24
|
-
|
|
24
|
+
tarball in a Buffer (or Uint8Array, or ArrayBuffer slice) into the
|
|
25
|
+
function, along with the folder you want to drop it in.
|
|
25
26
|
|
|
26
27
|
It will unpack as fast as possible, using synchronous I/O.
|
|
27
28
|
|
|
@@ -38,14 +39,13 @@ unpack(unzipped, 'node_modules/target')
|
|
|
38
39
|
|
|
39
40
|
### `class Pool`
|
|
40
41
|
|
|
41
|
-
Create a pool of worker threads which will service unpack
|
|
42
|
-
|
|
42
|
+
Create a pool of worker threads which will service unpack requests in
|
|
43
|
+
parallel.
|
|
43
44
|
|
|
44
45
|
New requests that get added will be assigned to workers as those
|
|
45
|
-
workers become available. When a worker completes its task, and
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
will be spawned.
|
|
46
|
+
workers become available. When a worker completes its task, and there
|
|
47
|
+
are no more tasks to assign, it is terminated. If not enough workers
|
|
48
|
+
are available to service requests, then new ones will be spawned.
|
|
49
49
|
|
|
50
50
|
#### `pool.jobs`
|
|
51
51
|
|
|
@@ -66,29 +66,27 @@ completed.
|
|
|
66
66
|
|
|
67
67
|
#### `pool.unpack(tarData: Buffer, target: string) => Promise<void>`
|
|
68
68
|
|
|
69
|
-
Unpack the supplied Buffer of data into the target folder,
|
|
70
|
-
|
|
69
|
+
Unpack the supplied Buffer of data into the target folder, using
|
|
70
|
+
synchronous I/O in a worker thread.
|
|
71
71
|
|
|
72
72
|
Promise resolves when this unpack request has been completed.
|
|
73
73
|
|
|
74
74
|
## Caveats
|
|
75
75
|
|
|
76
|
-
As stated above, **this is not a general purpose tar
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
doing this work, so faster sync IO for the whole thing is much
|
|
94
|
-
more optimal.
|
|
76
|
+
As stated above, **this is not a general purpose tar implementation**.
|
|
77
|
+
It does not handle symbolic links at all (those aren't allowed in
|
|
78
|
+
JavaScript packages). It does not respect uid/gid ownership flags. All
|
|
79
|
+
files are with a mode of `0o644` (or `0o666` on Windows - technically
|
|
80
|
+
it's `0o666` xor'ed with the system umask, so that'll often be `0o664`
|
|
81
|
+
on linux systems). All directories are created with a mode of `0o755`
|
|
82
|
+
by default (with the same windows/umask caveats as files, so maybe
|
|
83
|
+
that's `0o775` or some such.) All ctime/mtime/atime/birthtime values
|
|
84
|
+
will just be left as the current time.
|
|
85
|
+
|
|
86
|
+
It does not do any of the binary linking or other stuff that a package
|
|
87
|
+
manager will need to do. It _just_ does the unpack, as ruthlessly fast
|
|
88
|
+
as possible, and that's all.
|
|
89
|
+
|
|
90
|
+
Synchronous IO is used because that's faster and requires less CPU
|
|
91
|
+
utilization. The `Pool` class manages multiple worker threads doing
|
|
92
|
+
this work, so faster sync IO for the whole thing is much more optimal.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vltpkg/tar",
|
|
3
3
|
"description": "An extremely limited and very fast tar extractor",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-5",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"rimraf": "^6.0.1",
|
|
26
26
|
"tar": "^7.4.3",
|
|
27
|
-
"@vltpkg/error-cause": "0.0.0-
|
|
27
|
+
"@vltpkg/error-cause": "0.0.0-5"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@eslint/js": "^9.20.0",
|