Javascript NodeJS从base64服务映像

Javascript NodeJS从base64服务映像,javascript,node.js,mongodb,meteor,base64,Javascript,Node.js,Mongodb,Meteor,Base64,我的Meteor应用程序上有一条路线: this.route("/userimg/:id", function(){ console.log("hello"); img_base64 = Meteor.users.findOne(this.params.id).userimage; this.response.writeHead(200, {'Content-Type': 'image/png' }); },{where: 'se

我的Meteor应用程序上有一条路线:

    this.route("/userimg/:id", function(){
        console.log("hello");
        img_base64 = Meteor.users.findOne(this.params.id).userimage;
        this.response.writeHead(200, {'Content-Type': 'image/png' });

    },{where: 'server'});
通过这条路线,我想为我的Mongo收藏中的用户图像提供服务。 我的收藏中有一张base64编码图像,并将其保存到varibale
img_base64
。 我的问题是,我需要如何处理base64变量才能将其作为png响应? 我需要类似于
this.response.end(img\u base64,…)
的东西。
谢谢你的帮助

这就是您真正需要的(假设
img\u base64
是一个字符串):


这就是您真正需要的(假设
img_base64
是一个字符串):

this.response.end(img_base64, 'base64');