nodejs中的base64 JSON编码string

如何在nodejs中创buildbase64 JSON编码的string?

我试了这个,但没有奏效。

var buff = new Buffer({"hello":"world"}).toString("base64"); 

是这个吗?

 var buff = new Buffer(JSON.stringify({"hello":"world"})).toString("base64"); 

 var buff = new Buffer(JSON.stringify({"hello":"world"})).toString("base64");