code: async function dirExists(path) {
    try {
      const stats = await stat(path);
      return stats.isDirectory() ? true : false;
    } catch (err) {
      return false;
    }
  }
docs: Check if a directory exists
  @param path {string} - Path to the directory to check