const fs = require('fs'); const contents = fs.readFileSync('/path/to/file.jpg', {encoding: 'base64'});