【发布时间】:2016-03-13 12:44:29
【问题描述】:
我的 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-Collection 中提供用户图像。
我的收藏中有一个 base64 编码图像并将其保存到变量 img_base64。
我的问题是,我需要如何处理我的 base64 变量才能将其响应为 png?
我需要像this.response.end(img_base64,....) 这样的东西。
感谢您的帮助!
【问题讨论】:
标签: javascript node.js mongodb meteor base64