title: Convert binary to hex in node.js
body: <p>I want to ask I want to convert my binary data to hex before I will insert this to my table.</p>
  <pre><code>var net  = require('net');
  
  var server = net.createServer(function(socket){
  
      socket.on('data',function(data){
      var bindata= data.toString('binary');
  
      //filter(bindata);
  
      //if no error convert to hex.
      var hexdata = bindata.toString('hex');
  
      //insert hexdata here.
  });
  
  server.listen(3030,'127.0.0.1', function () {
      console.log(&quot;server is listenining&quot;);
  });
  </code></pre>
  <p>but the problem is that the binary data will be inserted.</p>