Our LDAP server returns the thumbnail in the following binary format. How can I save the stream as an image on the computer using NodeJS?
I tried the following solution, but the saved file thumbnail.jpeg cannot be opened as an image:
var fs = require('fs');
fs.writeFile('thumbnail.jpeg', {my binary stream}, 'binary',
function(err){
if (err) throw err;
console.log('File saved.')
})