I found the problem! I needed to specify 'encoding': 'binary' in request options and in writeFile: fs.writeFile(file, body, 'binary', function(err) {.
'encoding': 'binary'
fs.writeFile(file, body, 'binary', function(err) {
Now I can open and send correctly image and pdf from binary string.