Im making a call via Request to docusign like so:
var options = {
method: 'GET',
url: `${baseUrl}/envelopes/${envelopeId}/documents/${documentId}`,
headers: headers,
qs: {
encoding: 'base64'
}
};
request(options, function (error, response, body) {
...
})
Im getting back the document string but when I write it to a .pdf I get 4 blank pages. Here is the code im using to write it to a file:
fs.writeFile('cert.pdf', body, (err) => {
if(err) throw new Error(err)
})
Nodejs -v 8.11.1