title: Sending an image file response - node.js
body: <p>I need to implement a web server using only net module and socket.write commands.
  I'm using the following code for sending text files (html, css and etc):</p>
  
  <pre><code>fs.readFile(file,encoding='UTF8', function (err, data) {
  if (err) throw err;
  var dataToReturn=data.toString();
  socket.write('Content-Length:'+dataToReturn.length+'\r\n');
  socket.write('\r\n');
  socket.write(dataToReturn);
  });
  </code></pre>
  
  <p>Its working fine, but it doesn't work when I need to send image files.
  What should I do?</p>