title: Use variables among two exported functions
body: <p>I am getting errors while using variable among two exported Node.js function</p>
  
  <p>Variable name is buffer which is a Buffer.</p>
  
  <p>Am i right in using variable buffer in js code ?</p>
  
  <pre><code>module.exports = {
  
      var buffer ;
  
      init: function(data) 
      {
          buffer = data ;
      },
      test: function(word) 
      {
  
          var readline = require('readline');
          var stream = require('stream');
  
          // string to buffer
          var baseText = buffer;
          var buf = new Buffer(baseText);
  
          //buffer to stream
          var bufferStream = new stream.PassThrough();
          bufferStream.end(buf);
  
          var readLines = readline.createInterface({
              input: bufferStream,
          });
  
          var count = 0;
          readLines.on('line', function (line)
              {
                  if(line.toLowerCase().indexOf(word.toLowerCase()) != -1)
                  return true;
  
              }
          );
  
          return false;
      }
  }
  </code></pre>