node.js - NodeJS http.get quit my app -
i have werd problem. when running code image, images make line quit program. dont error , dont know how debug problem.
http.get(obj.image.url.split("?")[0], function (getresponse){ var chunks = []; getresponse.on('data', function (chunk){ chunks.push(chunk); }).on('end', function(){ if(getresponse.statuscode == 200){ var buffer = buffer.concat(chunks); obj.image = { url: obj.image.url, width: sizeof(buffer).width, height: sizeof(buffer).height } callback(obj); } }); });
i try put console.log in every step in function, nothing triggering after http.get...
http://static.feber.se/article_images/38/68/15/386815_1280.jpg - works https://tctechcrunch2011.files.wordpress.com/2015/02/crunchweek-4-3.jpg - fail
it's because have deal different protocols http://
, https://
. seems there's nothing built-in node.js
. may use modules request or needle instead. figure out protocol use, , how handle redirects (if required) , such.
Comments
Post a Comment