title: String compare with node.js
body: <p>I am doing a project where I am using a Tessel to read a text file on a server and perform a function based upon the value. I am fairly new to node.js, and have managed to get most of the items running, but I am having an issue getting the comparison to work.</p>
  
  <p>I know it is reading the value (which will either be a "1" or "0") fine because when I incorporate a console.log(//variable) in the code, the console shows the value.</p>
  
  <p>The basic code I have been playing with is:</p>
  
  <pre><code>var http = require('http');
  
  setInterval(function() {
  var options = {
    host: 'www.users.wfleitz.com',
    path: '/fleitzwc/example.txt'
  };
  
  callback = function(response) {
    var str = '';
  
    response.on('data', function (chunk) {
      str += chunk;
    });
  
    response.on('end', function () {
      console.log(str)
  
      if (str == "1"){
        console.log("It reads fine ")
    }     
    });
  
  }
  http.request(options, callback).end();
  
  }, 1000);
  </code></pre>
  
  <p>I have tried moving the "if" statement around, and also wording the "if" statement:</p>
  
  <pre><code>if (str.toString == "1"){
            console.log("It reads fine ")
        }
  </code></pre>
  
  <p>Could someone tell me if it is a placement, or syntax issue? Or if I am off base all together? I was thinking it may be that an issue where although the file should only have a "1" or "0" in it, I have had instances where I needed to trim the file contents to ensure I was only getting that one value, but I can't find a way to do it in node.js.</p>
  
  <p>Thank you in advance,
  WFleitz</p>