index.js
function renameFile(from, to) {
  return new Promise((resolve, reject) => {
    fs.rename(from, to, (err) => {
      if (err) {
        reject(err);
        return;
      }
      resolve(to);
    });
  });
}
function renameFile(from, to) {
  return new Promise((resolve, reject) => {
    fs.rename(from, to, (err) => {
      if (err) {
        reject(err);
        return;
      }
      resolve(to);
    });
  });
}
function renameFile ( from , to ) { return new Promise ( ( resolve , reject ) => { fs . rename ( from , to , ( err ) => { if ( err ) { reject ( err ) ; return ; } resolve ( to ) ; } ) ; } ) ; }
Rename a file to another path
@param {string} from origin path and filename
@param {string} to destination path and filename
@returns {Promise<string>} resolve with the destination filePath
Rename a file to another path