index.js
function getdirFiles(dir, prefix = '') {
  dir = path.normalize(dir);
  if (!fs.existsSync(dir)) return [];
  const files = fs.readdirSync(dir);
  let result = [];
  files.forEach(item => {
    const currentDir = path.join(dir, item);
    const stat = fs.statSync(currentDir);
    if (stat.isFile()) {
      result.push(path.join(prefix, item));
    } else if (stat.isDirectory()) {
      const cFiles = getdirFiles(currentDir, path.join(prefix, item));
      result = result.concat(cFiles);
    }
  });
  return result;
}
function getdirFiles(dir, prefix = '') {
  dir = path.normalize(dir);
  if (!fs.existsSync(dir)) return [];
  const files = fs.readdirSync(dir);
  let result = [];
  files.forEach(item => {
    const currentDir = path.join(dir, item);
    const stat = fs.statSync(currentDir);
    if (stat.isFile()) {
      result.push(path.join(prefix, item));
    } else if (stat.isDirectory()) {
      const cFiles = getdirFiles(currentDir, path.join(prefix, item));
      result = result.concat(cFiles);
    }
  });
  return result;
}
function getdirFiles ( dir , prefix = '' ) { dir = path . normalize ( dir ) ; if ( ! fs . existsSync ( dir ) ) return [ ] ; const files = fs . readdirSync ( dir ) ; let result = [ ] ; files . forEach ( item => { const currentDir = path . join ( dir , item ) ; const stat = fs . statSync ( currentDir ) ; if ( stat . isFile ( ) ) { result . push ( path . join ( prefix , item ) ) ; } else if ( stat . isDirectory ( ) ) { const cFiles = getdirFiles ( currentDir , path . join ( prefix , item ) ) ; result = result . concat ( cFiles ) ; } } ) ; return result ; }
get files in path
@param  {} dir    []
@param  {} prefix []
@return {}        []
get files in path