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 = {
url: 'https://api.line.me/v2/bot/message/6000684214622/content',
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?

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/22a58ccd-d884-48c1-adaf-bf01659e50bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to