packages/babel-minify/src/fs.js
async function readStdin() {
  let code = "";
  const stdin = process.stdin;
  return new Promise(resolve => {
    stdin.setEncoding("utf8");
    stdin.on("readable", () => {
      const chunk = process.stdin.read();
      if (chunk !== null) code += chunk;
    });
    stdin.on("end", () => {
      resolve(code);
    });
  });
}
async function readStdin() {
  let code = "";
  const stdin = process.stdin;
  return new Promise(resolve => {
    stdin.setEncoding("utf8");
    stdin.on("readable", () => {
      const chunk = process.stdin.read();
      if (chunk !== null) code += chunk;
    });
    stdin.on("end", () => {
      resolve(code);
    });
  });
}
async function readStdin ( ) { let code = "" ; const stdin = process . stdin ; return new Promise ( resolve => { stdin . setEncoding ( "utf8" ) ; stdin . on ( "readable" , ( ) => { const chunk = process . stdin . read ( ) ; if ( chunk !== null ) code += chunk ; } ) ; stdin . on ( "end" , ( ) => { resolve ( code ) ; } ) ; } ) ; }
the async keyword simply exists to denote we are returning a promise even though we don't use await inside it
the async keyword simply exists to denote we are returning a promise even though we don t use await inside it