summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/tar/lib/write-entry.js
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2018-04-20 18:26:37 -0700
committerRebecca Turner <me@re-becca.org>2018-05-24 23:24:45 -0700
commit468ab4519e1b92473acefb22801497a1af6aebae (patch)
treebdac1d062cd4b094bde3a21147bab5d82c792ece /deps/npm/node_modules/tar/lib/write-entry.js
parentac8226115e2192a7a46ba07789fa5136f74223e1 (diff)
downloadandroid-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.gz
android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.bz2
android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.zip
deps: upgrade npm to 6.1.0
PR-URL: https://github.com/nodejs/node/pull/20190 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'deps/npm/node_modules/tar/lib/write-entry.js')
-rw-r--r--deps/npm/node_modules/tar/lib/write-entry.js46
1 files changed, 27 insertions, 19 deletions
diff --git a/deps/npm/node_modules/tar/lib/write-entry.js b/deps/npm/node_modules/tar/lib/write-entry.js
index f562bf138a..7b43ebcd35 100644
--- a/deps/npm/node_modules/tar/lib/write-entry.js
+++ b/deps/npm/node_modules/tar/lib/write-entry.js
@@ -1,4 +1,5 @@
'use strict'
+const Buffer = require('./buffer.js')
const MiniPass = require('minipass')
const Pax = require('./pax.js')
const Header = require('./header.js')
@@ -44,6 +45,9 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
this.cwd = opt.cwd || process.cwd()
this.strict = !!opt.strict
this.noPax = !!opt.noPax
+ this.noMtime = !!opt.noMtime
+ this.mtime = opt.mtime || null
+
if (typeof opt.onwarn === 'function')
this.on('warn', opt.onwarn)
@@ -101,6 +105,9 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
}
[HEADER] () {
+ if (this.type === 'Directory' && this.portable)
+ this.noMtime = true
+
this.header = new Header({
path: this.path,
linkpath: this.linkpath,
@@ -110,8 +117,7 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
uid: this.portable ? null : this.stat.uid,
gid: this.portable ? null : this.stat.gid,
size: this.stat.size,
- mtime: this.type === 'Directory' && this.portable
- ? null : this.stat.mtime,
+ mtime: this.noMtime ? null : this.mtime || this.stat.mtime,
type: this.type,
uname: this.portable ? null :
this.stat.uid === this.myuid ? this.myuser : '',
@@ -124,7 +130,7 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
atime: this.portable ? null : this.header.atime,
ctime: this.portable ? null : this.header.ctime,
gid: this.portable ? null : this.header.gid,
- mtime: this.header.mtime,
+ mtime: this.noMtime ? null : this.mtime || this.header.mtime,
path: this.path,
linkpath: this.linkpath,
size: this.header.size,
@@ -294,28 +300,30 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
constructor (readEntry, opt) {
opt = opt || {}
super(opt)
+ this.preservePaths = !!opt.preservePaths
+ this.portable = !!opt.portable
+ this.strict = !!opt.strict
+ this.noPax = !!opt.noPax
+ this.noMtime = !!opt.noMtime
+
this.readEntry = readEntry
this.type = readEntry.type
+ if (this.type === 'Directory' && this.portable)
+ this.noMtime = true
+
this.path = readEntry.path
this.mode = readEntry.mode
if (this.mode)
this.mode = this.mode & 0o7777
- this.uid = readEntry.uid
- this.gid = readEntry.gid
- this.uname = readEntry.uname
- this.gname = readEntry.gname
+ this.uid = this.portable ? null : readEntry.uid
+ this.gid = this.portable ? null : readEntry.gid
+ this.uname = this.portable ? null : readEntry.uname
+ this.gname = this.portable ? null : readEntry.gname
this.size = readEntry.size
- this.mtime = readEntry.mtime
- this.atime = readEntry.atime
- this.ctime = readEntry.ctime
+ this.mtime = this.noMtime ? null : opt.mtime || readEntry.mtime
+ this.atime = this.portable ? null : readEntry.atime
+ this.ctime = this.portable ? null : readEntry.ctime
this.linkpath = readEntry.linkpath
- this.uname = readEntry.uname
- this.gname = readEntry.gname
-
- this.preservePaths = !!opt.preservePaths
- this.portable = !!opt.portable
- this.strict = !!opt.strict
- this.noPax = !!opt.noPax
if (typeof opt.onwarn === 'function')
this.on('warn', opt.onwarn)
@@ -341,7 +349,7 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
uid: this.portable ? null : this.uid,
gid: this.portable ? null : this.gid,
size: this.size,
- mtime: this.mtime,
+ mtime: this.noMtime ? null : this.mtime,
type: this.type,
uname: this.portable ? null : this.uname,
atime: this.portable ? null : this.atime,
@@ -353,7 +361,7 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
atime: this.portable ? null : this.atime,
ctime: this.portable ? null : this.ctime,
gid: this.portable ? null : this.gid,
- mtime: this.mtime,
+ mtime: this.noMtime ? null : this.mtime,
path: this.path,
linkpath: this.linkpath,
size: this.size,