tar 4.3.3 → 4.4.0
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 +6 -0
- package/lib/pack.js +3 -1
- package/lib/write-entry.js +4 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -428,6 +428,8 @@ The following options are supported:
|
|
|
428
428
|
Note that this prevents using other mtime-based features like
|
|
429
429
|
`tar.update` or the `keepNewer` option with the resulting tar archive.
|
|
430
430
|
[Alias: `m`, `no-mtime`]
|
|
431
|
+
- `mtime` Set to a `Date` object to force a specific `mtime` for
|
|
432
|
+
everything added to the archive. Overridden by `noMtime`.
|
|
431
433
|
|
|
432
434
|
### tar.r(options, fileList, callback) [alias: tar.replace]
|
|
433
435
|
|
|
@@ -477,6 +479,8 @@ The following options are supported:
|
|
|
477
479
|
Note that this prevents using other mtime-based features like
|
|
478
480
|
`tar.update` or the `keepNewer` option with the resulting tar archive.
|
|
479
481
|
[Alias: `m`, `no-mtime`]
|
|
482
|
+
- `mtime` Set to a `Date` object to force a specific `mtime` for
|
|
483
|
+
everything added to the archive. Overridden by `noMtime`.
|
|
480
484
|
|
|
481
485
|
|
|
482
486
|
## Low-Level API
|
|
@@ -527,6 +531,8 @@ The following options are supported:
|
|
|
527
531
|
- `noMtime` Set to true to omit writing `mtime` values for entries.
|
|
528
532
|
Note that this prevents using other mtime-based features like
|
|
529
533
|
`tar.update` or the `keepNewer` option with the resulting tar archive.
|
|
534
|
+
- `mtime` Set to a `Date` object to force a specific `mtime` for
|
|
535
|
+
everything added to the archive. Overridden by `noMtime`.
|
|
530
536
|
|
|
531
537
|
|
|
532
538
|
#### add(path)
|
package/lib/pack.js
CHANGED
|
@@ -89,6 +89,7 @@ const Pack = warner(class Pack extends MiniPass {
|
|
|
89
89
|
this.noDirRecurse = !!opt.noDirRecurse
|
|
90
90
|
this.follow = !!opt.follow
|
|
91
91
|
this.noMtime = !!opt.noMtime
|
|
92
|
+
this.mtime = opt.mtime || null
|
|
92
93
|
|
|
93
94
|
this.filter = typeof opt.filter === 'function' ? opt.filter : _ => true
|
|
94
95
|
|
|
@@ -293,7 +294,8 @@ const Pack = warner(class Pack extends MiniPass {
|
|
|
293
294
|
portable: this.portable,
|
|
294
295
|
linkCache: this.linkCache,
|
|
295
296
|
statCache: this.statCache,
|
|
296
|
-
noMtime: this.noMtime
|
|
297
|
+
noMtime: this.noMtime,
|
|
298
|
+
mtime: this.mtime
|
|
297
299
|
}
|
|
298
300
|
}
|
|
299
301
|
|
package/lib/write-entry.js
CHANGED
|
@@ -45,6 +45,7 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
|
|
|
45
45
|
this.strict = !!opt.strict
|
|
46
46
|
this.noPax = !!opt.noPax
|
|
47
47
|
this.noMtime = !!opt.noMtime
|
|
48
|
+
this.mtime = opt.mtime || null
|
|
48
49
|
|
|
49
50
|
if (typeof opt.onwarn === 'function')
|
|
50
51
|
this.on('warn', opt.onwarn)
|
|
@@ -115,7 +116,7 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
|
|
|
115
116
|
uid: this.portable ? null : this.stat.uid,
|
|
116
117
|
gid: this.portable ? null : this.stat.gid,
|
|
117
118
|
size: this.stat.size,
|
|
118
|
-
mtime: this.noMtime ? null : this.stat.mtime,
|
|
119
|
+
mtime: this.noMtime ? null : this.mtime || this.stat.mtime,
|
|
119
120
|
type: this.type,
|
|
120
121
|
uname: this.portable ? null :
|
|
121
122
|
this.stat.uid === this.myuid ? this.myuser : '',
|
|
@@ -128,7 +129,7 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
|
|
|
128
129
|
atime: this.portable ? null : this.header.atime,
|
|
129
130
|
ctime: this.portable ? null : this.header.ctime,
|
|
130
131
|
gid: this.portable ? null : this.header.gid,
|
|
131
|
-
mtime: this.noMtime ? null : this.header.mtime,
|
|
132
|
+
mtime: this.noMtime ? null : this.mtime || this.header.mtime,
|
|
132
133
|
path: this.path,
|
|
133
134
|
linkpath: this.linkpath,
|
|
134
135
|
size: this.header.size,
|
|
@@ -318,7 +319,7 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
|
|
|
318
319
|
this.uname = this.portable ? null : readEntry.uname
|
|
319
320
|
this.gname = this.portable ? null : readEntry.gname
|
|
320
321
|
this.size = readEntry.size
|
|
321
|
-
this.mtime = this.noMtime ? null : readEntry.mtime
|
|
322
|
+
this.mtime = this.noMtime ? null : opt.mtime || readEntry.mtime
|
|
322
323
|
this.atime = this.portable ? null : readEntry.atime
|
|
323
324
|
this.ctime = this.portable ? null : readEntry.ctime
|
|
324
325
|
this.linkpath = readEntry.linkpath
|
package/package.json
CHANGED