'use strict'
// tar -u
const hlo = require('./high-level-opt.js')
const r = require('./replace.js')
// just call tar.r with the filter and mtimeCache
const u = module.exports = (opt_, files, cb) => {
const opt = hlo(opt_)
if (!opt.file)
throw new TypeError('file is required')
if (opt.gzip)
throw new TypeError('cannot append to compressed archives')
if (!files || !Array.isArray(files) || !files.length)
throw new TypeError('no files or directories specified')
files = Array.from(files)
mtimeFilter(opt)
return r(opt, files, cb)
}
const mtimeFilter = opt => {
const filter = opt.filter
if (!opt.mtimeCache)
opt.mtimeCache = new Map()
opt.filter = filter ? (path, stat) =>
filter(path, stat) && !(opt.mtimeCache.get(path) > stat.mtime)
: (path, stat) => !(opt.mtimeCache.get(path) > stat.mtime)
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| buffer.js | File | 283 B | 0644 |
|
| create.js | File | 2.32 KB | 0644 |
|
| extract.js | File | 2.76 KB | 0644 |
|
| header.js | File | 8.83 KB | 0644 |
|
| high-level-opt.js | File | 772 B | 0644 |
|
| large-numbers.js | File | 2.16 KB | 0644 |
|
| list.js | File | 3.08 KB | 0644 |
|
| mkdir.js | File | 5.06 KB | 0644 |
|
| mode-fix.js | File | 277 B | 0644 |
|
| pack.js | File | 9.39 KB | 0644 |
|
| parse.js | File | 11.86 KB | 0644 |
|
| pax.js | File | 3.97 KB | 0644 |
|
| read-entry.js | File | 2.61 KB | 0644 |
|
| replace.js | File | 5.36 KB | 0644 |
|
| types.js | File | 1.07 KB | 0644 |
|
| unpack.js | File | 16.46 KB | 0644 |
|
| update.js | File | 852 B | 0644 |
|
| warn-mixin.js | File | 309 B | 0644 |
|
| winchars.js | File | 533 B | 0644 |
|
| write-entry.js | File | 11.77 KB | 0644 |
|