In my application, I want whenever the app starts up, image must get store on the server. But I am the following error.
W20150626-02:39:51.690(5.5)? (STDERR)
/home/deepak/Sagittarius/OGV-meteor OGV/.meteor/local/build/programs/server/packages/meteor.js:1055
W20150626-02:39:51.691(5.5)? (STDERR)
Fiber(runWithEnvironment).run();
W20150626-02:39:51.691(5.5)? (STDERR) ^
W20150626-02:39:51.711(5.5)? (STDERR) TypeError: Object
#<EventEmitter> has no method 'storeBuffer'
W20150626-02:39:51.711(5.5)? (STDERR) at app/server/test.js:9:24
W20150626-02:39:51.711(5.5)? (STDERR) at runWithEnvironment
(packages/meteor/dynamics_nodejs.js:108:1)
Following is my code snippet.
Meteor.startup(function () {
var fs = Npm.require('fs');
fs.readFile(process.env.PWD + '/public/tasveer/profile-pic.jpg',
Meteor.bindEnvironment(function (err, data) {
if (err) throw err;
// prints buffer
console.log(data);
ThumbFiles.storeBuffer('profile-pic.jpg', data, {
contentType: 'image/*',
encoding: 'binary'
});
},
function(e){
throw e;
}));
});
What is the problem? Where I am doing wrong?