title: Can we save data into file using websocket?
body: <p>I have a logs that are displaying to client live using <code>socket.io</code> now there is requirement where user can record logs according to their requirement in particular,so i want user to have ability to get logs using <code>socket.io</code> and log into file so it should start recording when user click on record and stop recording and save when user click on stop.How can we append data to file that is being listen on <code>socket.io</code> ?</p>
  
  <p>main.html</p>
  
  <pre><code>&lt;div class="col-md-9" style="height: 600px; width: 1000px; overflow: scroll"&gt;
    &lt;ul&gt;
      &lt;li ng-repeat="message in event track by $index"&gt;{{message}}&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  
  &lt;button type="button" class="btn btn-success" ng-click="recordLogs()"&gt;&lt;a href="" id="a"&gt;record&lt;/a&gt;&lt;/button&gt;
  &lt;button type="button" class="btn btn-success" ng-click="stopLogs()"&gt;stop&lt;/button&gt;
  </code></pre>
  
  <p>ctrl.js</p>
  
  <pre><code>$scope.event = [];
  socket.on('ditConsumer', function(data) {
      $scope.event.push(data);
  });
  </code></pre>
  
  <p>Here once user click on <code>recordLogs()</code> i want to create a file and start logging messages that are coming after invoking <code>recordLogs()</code>to a file. </p>
  
  <pre><code>$scope.recordLogs = function() {
    //create a file and start logging from this point to a file
  }
  </code></pre>
  
  <p>server.js</p>
  
  <pre><code>io.sockets.on('connection',function(){
     // Producer.startProducer();
      ditconsumer.start(function(value){
          io.emit('ditConsumer',value)
      });
  });
  </code></pre>