title: Does a lowdb file database stay in memory with node.js?
body: <p>If I read the <a href="https://github.com/typicode/lowdb" rel="nofollow">lowdb</a> database in <code>file1.js</code></p>
  
  <pre><code>var users = require('lowdb')('./db.json')('users');
  
  // do something with users
  </code></pre>
  
  <p>when I use it a second time in <code>file2.js</code></p>
  
  <pre><code>var settings = require('lowdb')('./db.json')('settings');
  
  // do something with settings
  </code></pre>
  
  <p>does node perform a second read file operation? Or does it get read once after <code>node index.js</code> and it stays in memory?</p>
  
  <p>I've always had this question about reading files in node. What I've been doing all this time whenever I want to prevent multiple reading operations (if that's the case in node) is:</p>
  
  <pre><code>var fs = require('fs');
  
  module.exports = Foo = {
      init(): function() {
          Foo.bar = fs.readFile('someFile');
      }
  };
  </code></pre>
  
  <p>So somewhere in the code (usually <code>index.js</code>), I'd <code>Foo.init()</code>, and then whenever I need to read the contents, I'd read <code>Foo.bar</code>.</p>