Skip to content
Like `fs.rename`, but works across devices, and works with directories. Think of the unix utility `mv`.
Branch: master
Clone or download
Latest commit 645d8f4 Jun 23, 2015
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test Ensure rimraf 2.4.x doesn't apply globs when moving directories. Jun 22, 2015
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

Build Status

Usage:

var mv = require('mv');

mv('source/file', 'dest/file', function(err) {
  // done. it tried fs.rename first, and then falls back to
  // piping the source file to the dest file and then unlinking
  // the source file.
});

Another example:

mv('source/dir', 'dest/a/b/c/dir', {mkdirp: true}, function(err) {
  // done. it first created all the necessary directories, and then
  // tried fs.rename, then falls back to using ncp to copy the dir
  // to dest and then rimraf to remove the source dir
});

Another example:

mv('source/file', 'dest/file', {clobber: false}, function(err) {
  // done. If 'dest/file' exists, an error is returned
  // with err.code === 'EEXIST'.
});
You can’t perform that action at this time.