code: function readDirectoryFiles(directory) {
    return new Promise((resolve, reject) => {
      fs.readdir(directory, (err, files) => {
        if (err) {
          reject(err);
          return;
        }
  
        const isFile = fileName => readFileStats(path.join(directory, fileName))
          .then((fstat) => {
            if (fstat.isFile()) {
              return fileName;
            }
            return null;
          });
  
        Promise.all(files.map(isFile))
          .then(fileList => resolve(fileList.filter(f => f !== null)))
          .catch(reject);
      });
    });
  }
docs: List the files names of a directory, ignoring directories
  @param {string} directory path of the directory to read
  @returns {Promise<array>} strings names of the files in the input directory