node.jsでhttpsを使用しているときに、応答データの読み取りに固執しました。以下はhttpsリクエストのコードです。
https.get(options, function(resp) {
console.log(resp.headers) //working fine
resp.on('data', function(d) {
console.log(d) // buffered data; like <Buffer 7b 22 69...
process.stdout.write(d); // working fine(prints decoded data in console)
var decoded_data=??? });
}).on('error', function(e) {
console.error(e);
});
しかし、どうすれば応答データをデコードして変数に書き込むことができますか?