Answer the question
In order to leave comments, you need to log in
How to send an image via npm request?
A captcha arrives from vk.com, you need to send it to the captcha service. I
use the npm request module.
I stumbled upon a problem:
the file received via callback differs from the file written using pipe. and the file received through pipe is the only correct one. File via callback contains much more information
request.get({
url: 'http:\/\/api.vk.com\/captcha.php?sid=239633676097&s=1',
proxy: 'http://342',
strictSSL: false,
headers: {
'User-Agent': ''
}
},
function (err, res, body) {
if (err) {
console.log('ERROR ', err);
} else {
console.log('OK ', res);
fs.writeFile('file1.txt', body, 'ascii', function(){});
}
}).pipe(fs.createWriteStream('file2.txt'));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question