src/copy.js
function copyFile(srcPath, destPath) {
        let srcFileInfo = path.parse(srcPath) || {};
        if (!path.extname(destPath) && srcFileInfo.ext) {
            // destination is a directory!
            return copyFileIntoDirectory(srcPath, destPath);
        } else {
            return new Promise(function (resolve, reject) {
                fs.copy(srcPath, destPath, function (err) {
                    if (!err) {
                        resolve();
                    } else {
                        reject(err);
                    }
                });
            });
        }
    }
function copyFile(srcPath, destPath) {
        let srcFileInfo = path.parse(srcPath) || {};
        if (!path.extname(destPath) && srcFileInfo.ext) {
            // destination is a directory!
            return copyFileIntoDirectory(srcPath, destPath);
        } else {
            return new Promise(function (resolve, reject) {
                fs.copy(srcPath, destPath, function (err) {
                    if (!err) {
                        resolve();
                    } else {
                        reject(err);
                    }
                });
            });
        }
    }
function copyFile ( srcPath , destPath ) { let srcFileInfo = path . parse ( srcPath ) || { } ; if ( ! path . extname ( destPath ) && srcFileInfo . ext ) { // destination is a directory! return copyFileIntoDirectory ( srcPath , destPath ) ; } else { return new Promise ( function ( resolve , reject ) { fs . copy ( srcPath , destPath , function ( err ) { if ( ! err ) { resolve ( ) ; } else { reject ( err ) ; } } ) ; } ) ; } }
Copies one path to another one.
@param {String} srcPath - source path
@param {String} destPath - destination path
@returns {Promise} Returns a promise when done
Copies one path to another one .