When I sending the following request ,
var request = require('request');
var fs = require("fs");
var headers = {
'Authorization': 'Bearer cEet0ordwd4VsUHi9jnbQuWIY+fL5RKeSGP65HEbGtGznHQ4XOaOwaTDQqwLT0bI24oFKLtMvspYvPgi4qR3Bv1oMQp+Wak2x7TRSxsL/oqQN1kIzaWVcGTk9aK4ICxU6qK4tM0KHoAkjA1ahEJSswdB04t89/1O/w1cDnyilFU='
};
var options = {
headers: headers
};
var r=request(options );
r.pipe(fs.createWriteStream('./m10.wav' ));
in here the type of the request is an object.
Now the file I can open with a music player. But when I writing the body of the request like,
request(options,function (err,res,body){
var p=body;
p.pipe(fs.createWriteStream('./m10.wav' ));
})
in here the type of body is string.
I can't open the file. It shows error. How can I write this file and When I checking the type of both responce first one is an object type and second once is a string type. Any problem for writing string data using fs?