code: function (dir, filelist, extensions, ignore) {
      const files = fs.readdirSync(dir);
      filelist = filelist || [];
      files.forEach(function (file) {
          const ext = fileExtension(file);
          if (ignore.indexOf(ext) === -1) {
              if (fs.statSync(path.resolve(dir, file)).isDirectory()) {
                  filelist = walkSync(path.join(dir, file, "/"), filelist, extensions, ignore);
              }
              else {
                  if (extensions.indexOf(ext) !== -1) {
                      filelist.push(path.join(dir, file));
                  }
              }
          }
      });
      return filelist;
  }
docs: List all files in a directory in Node.js recursively in a synchronous fashion