mirror of
https://github.com/electron/node-gyp.git
synced 2025-09-19 07:13:40 +02:00
Update bundled node-tar to v0.1.13
This commit is contained in:
parent
eac48fe38b
commit
10820750f0
4 changed files with 97 additions and 12 deletions
14
node_modules/tar/lib/extract.js
generated
vendored
14
node_modules/tar/lib/extract.js
generated
vendored
|
@ -24,6 +24,10 @@ function Extract (opts) {
|
|||
opts.type = "Directory"
|
||||
opts.Directory = true
|
||||
|
||||
// similar to --strip or --strip-components
|
||||
opts.strip = +opts.strip
|
||||
if (!opts.strip || opts.strip <= 0) opts.strip = 0
|
||||
|
||||
this._fst = fstream.Writer(opts)
|
||||
|
||||
this.pause()
|
||||
|
@ -33,6 +37,16 @@ function Extract (opts) {
|
|||
// of the tarball. So, they need to be resolved against
|
||||
// the target directory in order to be created properly.
|
||||
me.on("entry", function (entry) {
|
||||
// if there's a "strip" argument, then strip off that many
|
||||
// path components.
|
||||
if (opts.strip) {
|
||||
var p = entry.path.split("/").slice(opts.strip).join("/")
|
||||
entry.path = entry.props.path = p
|
||||
if (entry.linkpath) {
|
||||
var lp = entry.linkpath.split("/").slice(opts.strip).join("/")
|
||||
entry.linkpath = entry.props.linkpath = lp
|
||||
}
|
||||
}
|
||||
if (entry.type !== "Link") return
|
||||
entry.linkpath = entry.props.linkpath =
|
||||
path.join(opts.path, path.join("/", entry.props.linkpath))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue