title: How can I use readline synchronously?
body: <p>I'm simply trying to wait for a user to enter a password and then use it before moving on the rest of my code. The error is <code>Cannot read property 'then' of undefined</code>.</p>
  
  <pre><code>let rl = readline.createInterface({
      input: process.stdin,
      output: process.stdout
  });
  
  rl.question('Password: ', password =&gt; {
      rl.close();
      return decrypt(password);
  }).then(data =&gt;{
      console.log(data);
  });
  
  function decrypt( password ) {
      return new Promise((resolve) =&gt; {
          //do stuff
          resolve(data);
      });
  }
  </code></pre>