Decoding https response data in node.js

While playing with https in node.js, I have stucked in reading response data. Following is the code for https request;

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);
});

But, how can I decode response data & write it into a variable?

var decoded_data = d.toString('utf8');

or, earlier on:

resp.setEncoding('utf8');

and then all your on events will give you a string instead of a buffer.