INNER CODE UNIT · JavaScript

getInputData

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

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");
  }

  return await new Promise((resolve, reject) => {
    let data = "";
    process.stdin.on("readable", function () {
      const chunk = process.stdin.read();

      if (chunk !== null) {
        data += chunk;
      }
    });

    process.stdin.on("error", function (err) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…