title: Check if NodeJS ClearTextStream stream is "ended"?
body: <p>I have a ClearTextStream for a TLS connection and I want to check if "end" was already called. The actual problem is, that I'm trying to write something into the stream and I get an "write after end" error.</p>
  
  <p>Now to avoid that, I just want to check if "end" was already called. I do have an "close" event, but it isn't fired in all cases.</p>
  
  <p>I can't find it in the <a href="http://nodejs.org/api/tls.html#tls_class_tls_cleartextstream" rel="noreferrer">documentation</a> and I couldn't find anything like that by googling.</p>
  
  <p>I could check the error event (which is throwing "write after end" for me) and handle the situation there - but is there really no way to check this in the beginning? </p>
  
  <p>Thanks!</p>