tar 4.4.7 → 4.4.8
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 +1 -1
- package/lib/unpack.js +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,7 +108,7 @@ tar.c( // or tar.create
|
|
|
108
108
|
gzip: <true|gzip options>
|
|
109
109
|
},
|
|
110
110
|
['some', 'files', 'and', 'folders']
|
|
111
|
-
).pipe(fs.createWriteStream('my-tarball.tgz')
|
|
111
|
+
).pipe(fs.createWriteStream('my-tarball.tgz'))
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
To replicate `tar xf my-tarball.tgz` you'd do:
|
package/lib/unpack.js
CHANGED
|
@@ -178,6 +178,12 @@ class Unpack extends Parser {
|
|
|
178
178
|
if (parts.length < this.strip)
|
|
179
179
|
return false
|
|
180
180
|
entry.path = parts.slice(this.strip).join('/')
|
|
181
|
+
|
|
182
|
+
if (entry.type === 'Link') {
|
|
183
|
+
const linkparts = entry.linkpath.split(/\/|\\/)
|
|
184
|
+
if (linkparts.length >= this.strip)
|
|
185
|
+
entry.linkpath = linkparts.slice(this.strip).join('/')
|
|
186
|
+
}
|
|
181
187
|
}
|
|
182
188
|
|
|
183
189
|
if (!this.preservePaths) {
|
package/package.json
CHANGED