- Create a
get-base64.jsfile with the content as below
const fs = require('fs');
console.log(fs.readFileSync(
'<file path>',
{encoding: 'base64'}
));- Run the following command
node get-base64.jsget-base64.js file with the content as belowconst fs = require('fs');
console.log(fs.readFileSync(
'<file path>',
{encoding: 'base64'}
));node get-base64.js