src/utils.js
function fileToString(file) {
  try {
    const stat = fs.lstatSync(file);

    if (stat.isFile()) {
      const content = fs.readFileSync(file, 'utf8');
      return content.toString();
    }
  }
  catch (e) {
    if (!e.message.includes('ENOENT') && !e.message.includes('name too long, lstat')) {
      throw e;
    }
  }
  return file;
}
function fileToString(file) {
  try {
    const stat = fs.lstatSync(file);

    if (stat.isFile()) {
      const content = fs.readFileSync(file, 'utf8');
      return content.toString();
    }
  }
  catch (e) {
    if (!e.message.includes('ENOENT') && !e.message.includes('name too long, lstat')) {
      throw e;
    }
  }
  return file;
}
Checks if the input is a file, if it is a file,
it reads it and return the content, otherwise just pass
the input as an output

@param {String} file A file path or a string
@returns {String} String content of a given file