Reputation: 4331
I want to deploy a meteor app to meteor.com.
Unfortunately I have to write some tmp files to the public folder of meteor.
Example Code:
var fs = Npm.require('fs');
var filepath = "../../../../../public/resizing/tmp~";
fs.open(localpath, 'w', function(err,fd)
{
if(err) throw "error opening file";
fs.close(fd,function(){});
}
( ../../../../../public
is the location of the meteor public folder after bundling! )
This works fine on my local machine, because I have write privileges inside the public folder. Is there a way how I can write to a tmp file in an app that is deployed to meteor?
Upvotes: 0
Views: 658
Reputation: 19544
Most cloud providers don't allow access to file system, because this would put too much constraints on the architecture. Meteor.com is not different. For Meteor, there's also a problem of /public
dir being precached by the engine, so every change to that folder would result in server being restarted (you can see that on your local machine as well).
Whatever you're trying to achieve, there are different ways. The most common ones are:
Upvotes: 1
Reputation: 352
Meteor allows people to deploy apps to meteor.com as a courtesy, but I agree that writing to the file system dynamically would be a security risk for them. You can package your app and deploy it to your own server somewhere if that's easier, but you might want to rewrite the app logic itself to keep that data somewhere other than the same location of your app (S3, for instance). I'm assuming you're trying to store images or something. If it's not, just use Meteor's data stores and keep it there.
Upvotes: 1