title: NodeJS require('./path/to/image/image.jpg') as base64
body: <p>Is there a way to tell <code>require</code> that if file name ends with <code>.jpg</code> then it should return base64 encoded version of it?</p>
  
  <pre><code>var image = require('./logo.jpg');
  console.log(image); // data:image/jpg;base64,/9j/4AAQSkZJRgABAgA...
  </code></pre>