function promiseStat(filePath) {
  return new Promise((resolve, reject) => {
    fs.stat(filePath, (err, stats) => {
      if (err == null) {
        resolve(stats);
      } else {
        reject(err);
      }
    });
  }).catch(err => {
    throw new Error(`Error occurs in promiseStat: ${err}`);
  });
}
/** Promise version of fs.stat
 * @param filePath:String. The file or dir filePath
 * @returns Promise<String> The stats of the file or dir
 */
Promise version of fs.stat
@param filePath:String. The file or dir filePath
@returns Promise The stats of the file or dir
Promise version of fs . stat @param filePath : String . The file or dir filePath @returns Promise The stats of the file or dir
function promiseStat(filePath) {
  return new Promise((resolve, reject) => {
    fs.stat(filePath, (err, stats) => {
      if (err == null) {
        resolve(stats);
      } else {
        reject(err);
      }
    });
  }).catch(err => {
    throw new Error(`Error occurs in promiseStat: ${err}`);
  });
}
function promiseStat ( filePath ) { return new Promise ( ( resolve , reject ) => { fs . stat ( filePath , ( err , stats ) => { if ( err == null ) { resolve ( stats ) ; } else { reject ( err ) ; } } ) ; } ) . catch ( err => { throw new Error ( ` ${ err } ` ) ; } ) ; }
Promise version of fs.stat
 @param filePath:String.
Promise version of fs . stat @param filePath : String .