{"size": 1367, "ext": "js", "max_stars_repo_path": "util.js", "max_stars_repo_name": "Niaz-Ul-Haque/insane-cli", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "util.js", "max_issues_repo_name": "Niaz-Ul-Haque/insane-cli", "max_issues_repo_issues_event_min_datetime": "2020-09-22T21:52:59.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-22T17:54:45.000Z", "max_forks_repo_path": "util.js", "max_forks_repo_name": "Niaz-Ul-Haque/insane-cli", "max_forks_repo_forks_event_min_datetime": "2020-09-24T15:44:35.000Z", "max_forks_repo_forks_event_max_datetime": "2020-11-29T02:46:49.000Z"}
{"max_stars_count": null, "max_issues_count": 9, "max_forks_count": 4, "avg_line_length": 26.2884615385, "max_line_length": 77, "alphanum_fraction": 0.5369422092}
const fs = require("fs");
const readline = require("readline");

function readFiles(filename) {
  return new Promise((resolve, reject) => {
    try {
      if (fs.existsSync(filename)) {
        // check if file exist
        (async () => {
          await fs.promises
            .readFile(filename)
            .then(function (data) {
              resolve(data.toString());
            })
            .catch(function (error) {
              console.log(error);
            });
        })();
      } else {
        console.log("File not found!");
      }
    } catch (err) {
      console.error(err);
    }
  });
}

function showHelp() {
  console.log("HOW TO USE".bgGreen);
  console.log("------------------------------------------------".blue);
  console.log(" insane-cli".green + " for instructions".blue);
  console.log(
    " insane-cli [--version][/v]".green + " to check current version".blue
  );
  console.log(" insane-cli [file-path]".green + " process a file".blue);
  console.log(
    " insane-cli -url [full-url-link]".green + " process body's link".blue
  );
  console.log(
    " insane-cli -j [file-path]".green + " print results in JSON format".blue
  );
  console.log(
    " insane-cli [file-path] -i/--ignore [ignore.txt]".green +
      " ignore URLs in ignore.txt while testing a file".blue
  );
}

module.exports = {
  readFiles,
  showHelp,
};
