INNER CODE UNIT · JavaScript

checkConfigFile

mermaid-js/mermaid-cli · src/index.js:85

const checkConfigFile = (file) => {
  if (!fs.existsSync(file)) {
    error(`Configuration file "${file}" doesn't exist`);
  }
};

/**
 * Gets the data in the given file.
 *
 * @param {string | undefined} inputFile - The file to read.
 * If `undefined`, reads from `stdin` instead.
 * @returns {Promise<string>} The contents of `inputFile` parsed as `utf8`.
 */
async function getInputData(inputFile) {
  // if an input file has been specified using '-i', it takes precedence over
  // piping from stdin
  if (typeof inputFile !== "undefined") {
    return await fs.promises.readFile(inputFile, "utf-8");

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…