3

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?

The received binary stream

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.')     
  })
virusrocks
  • 861
  • 1
  • 5
  • 19
G Chen
  • 199
  • 3
  • 12

0 Answers0