title: Understanding the WriteStream in Node.js
body: <p>Recently I wrote a small multi room chat application using Node.js and Socket.IO and I log the sent messages into different files depending on the room they occured in. At the moment I am using a number of writeStreams (one for each room) to archive this functionality, but while it works, I have been wondering if this is actually how writeStreams are supposed to be used.</p>
  
  <p>My concerns:</p>
  
  <ol>
  <li>When I first implemented writeStream it seemed the perfect match as instead of writing entire files it just wrote messages whenever a new one is posted - in retrospective however I am not sure if having 10-20 Streams open all the time is ideal. </li>
  <li>Currently I use the .end() function when the last User leaves a room, but aside from a callback function I can't use in this case, there seems to be no way of telling if all messages have been written already when calling end(), which brings me right back to 1. and the questions if I am actually using writeStreams as they are meant to be used.  </li>
  </ol>
  
  <p>I guess my question is... can/should writeStreams be used for logging purposes in such a case? Are those actually hogging resources while waiting for input or is it save to have a large number open for extended periods of time?</p>