Sha256: b4db5dcaa2b525676afe8c30d178d1b59978a0497f406b440e9a7dc45cbfeca9

Contents?: true

Size: 852 Bytes

Versions: 48

Compression:

Stored size: 852 Bytes

Contents

'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)
}

Version data entries

48 entries across 32 versions & 9 rubygems

Version Path
disco_app-0.18.0 test/dummy/node_modules/node-pre-gyp/node_modules/tar/lib/update.js
disco_app-0.18.0 test/dummy/node_modules/fsevents/node_modules/tar/lib/update.js
disco_app-0.18.2 test/dummy/node_modules/node-pre-gyp/node_modules/tar/lib/update.js
disco_app-0.16.1 test/dummy/node_modules/node-pre-gyp/node_modules/tar/lib/update.js
disco_app-0.15.2 test/dummy/node_modules/node-pre-gyp/node_modules/tar/lib/update.js
disco_app-0.18.4 test/dummy/node_modules/node-pre-gyp/node_modules/tar/lib/update.js
disco_app-0.18.1 test/dummy/node_modules/node-pre-gyp/node_modules/tar/lib/update.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/node-pre-gyp/node_modules/tar/lib/update.js
disco_app-0.14.0 test/dummy/node_modules/node-pre-gyp/node_modules/tar/lib/update.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/node-pre-gyp/node_modules/tar/lib/update.js
tang-0.2.1 spec/tang_app/node_modules/tar/lib/update.js
tang-0.2.0 spec/tang_app/node_modules/tar/lib/update.js
tang-0.1.0 spec/tang_app/node_modules/tar/lib/update.js
tang-0.0.9 spec/tang_app/node_modules/tar/lib/update.js
enju_library-0.3.8 spec/dummy/node_modules/fsevents/node_modules/tar/lib/update.js
ilog-0.4.1 node_modules/fsevents/node_modules/tar/lib/update.js
ilog-0.4.0 node_modules/fsevents/node_modules/tar/lib/update.js
ilog-0.3.3 node_modules/fsevents/node_modules/tar/lib/update.js
jester-data-8.0.0 node_modules/fsevents/node_modules/tar/lib/update.js
jester-data-8.0.0 node_modules/node-pre-gyp/node_modules/tar/lib/update.js