var request = require('request');
'url': "https://worker.formextractorai.com/extract",
'X-WORKER-TOKEN': "ACCESS_TOKEN",
'X-WORKER-FORM-ID': "FORM_ID",
'Content-Type': 'image/jpeg',
'X-WORKER-ENCODING': 'base64'
body: base64_encode("FILE_PATH_TO_IMAGE")
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
// function to encode file data to base64 encoded string
function base64_encode(file) {
var bitmap = fs.readFileSync(file);
// convert binary data to base64 encoded string
return new Buffer(bitmap).toString('base64');