await move(source, destination)
// Move one file to a directory, keeping the same name
await move('./src/index.html', './dist');
// Move one file, with a new name
await move('./src/alpha.html', './dist/beta.html');
// Move files by glob pattern
await move('./src/*.html', './dist');
This method is clever enough to understand your intent. For example, when copying a file to a directory, it will put the file inside the directory, but when copying a file to another file it will replace the destination.
It will also throw errors instead of performing potentially dangerous operations like overwriting a file with a directory, or copying multiple files to the same destination file.