diff --git a/README.md b/README.md index 240eb6f..4b4a8bd 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,9 @@ Options include: dereference: false, // dereference any symlinks equals: fun, // optional function to determine if two entries are the same, see below ignore: null, // optional function to ignore file paths on src or dest - dryRun: false // emit all events but don't write/del files, - keepExisting: false // whether to delete extra files in the destination that are not present in the source + dryRun: false, // emit all events but don't write/del files, + keepExisting: false, // whether to delete extra files in the destination that are not present in the source + skipSpecial: true // skip any files that are not regular files } ``` diff --git a/index.js b/index.js index d48c686..b27d7d4 100644 --- a/index.js +++ b/index.js @@ -9,6 +9,7 @@ module.exports = mirror function mirror (src, dst, opts, cb) { if (typeof opts === 'function') return mirror(src, dst, null, opts) if (!opts) opts = {} + if (opts.skipSpecial !== false) opts.skipSpecial = true var progress = new events.EventEmitter() progress.destroy = destroy @@ -89,6 +90,11 @@ function mirror (src, dst, opts, cb) { // copy to b if (a.stat && !b.stat) return put(a, b, next) + if (!a.stat.isDirectory() && opts.skipSpecial && !a.stat.isFile()) { + progress.emit('skip', a, b) + return next() + } + // check if they are the same equals(a, b, function (err, same) { if (err) throw err