code: function getFileList(dir, sort = true) {
      return new Promise((resolve, reject) => {
          readdir(dir, (error, files) => {
              if (error) {
                  reject(error);
                  return;
              }
              let resultantFilesList;
  
              if (sort) {
                  const stripLength = (dir.substr(0, 2) === './') ? dir.length - 1 : dir.length + 1;
                  let pathsUnified = files.map((pth => pth.substr(stripLength).replace(/[\\/]/gm, '-')));
                  const temporaryIndex = {};
                  files.forEach((file, i) => {
                      temporaryIndex[pathsUnified[i]] = file;
                  });
                  pathsUnified = pathsUnified.sort();
                  const filesSorted = [];
                  pathsUnified.forEach((key) => {
                      filesSorted.push(temporaryIndex[key]);
                  });
  
                  resultantFilesList = filesSorted;
              } else {
                  resultantFilesList = files;
              }
              resolve(resultantFilesList);
          });
      });
  }
docs: Returns a file list from a directory.
  @param {string} dir - dir path
  @returns {Promise<Array>}