{"size": 529, "ext": "js", "max_stars_repo_path": "src/asciiart/ImageToAsciiArt.js", "max_stars_repo_name": "EsrefDurna/chinese-cli-game", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/asciiart/ImageToAsciiArt.js", "max_issues_repo_name": "EsrefDurna/chinese-cli-game", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/asciiart/ImageToAsciiArt.js", "max_forks_repo_name": "EsrefDurna/chinese-cli-game", "max_forks_repo_forks_event_min_datetime": "2020-11-03T05:53:22.000Z", "max_forks_repo_forks_event_max_datetime": "2020-11-03T05:53:22.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 27.8421052632, "max_line_length": 64, "alphanum_fraction": 0.6956521739}
const imageToAscii = require('image-to-ascii');
const { promisify } = require('util');
const imageToAsciiConfig = require('../../config/imageToAscii');

async function ImageToAsciiArt(imagePath, config = {}) {
  try {
    const cfg = Object.assign({}, imageToAsciiConfig, config);
    const imageToAsciiPromise = promisify(imageToAscii);
    const displayed = await imageToAsciiPromise(imagePath, cfg);
    return displayed;
  } catch (err) {
    console.error(err);
    throw err;
  }
}
module.exports = {
  ImageToAsciiArt,
};
