Closed rodrigok closed 9 years ago
Hi @rodrigok, I understand your reaction, but as the Local store works with the file system, the endpoint is something relative to that package only, I will make it configurable very soon !
My point of view is that another store like an eventual Amazon S3 would not provide an endpoint in Meteor because the file is not stored locally.
Consider having 2 stores :
Maybe I'am wrong but this is how I imagined the things. I'am open to all suggestions though.
@rodrigok Okay, you were right ! I looked more of how I could move all that to the main package, I did the job, this brings some changes in the next release v0.2.2 :
UploadFS.Store.prototype.getURL = function() This method returns the URL of the store.
UploadFS.Store.prototype.getFileURL = function (fileId) Moved from jalik:ufs-local package, it is now generic.
I already added the UploadFS.config.storesPath option to configure the base path of the endpoint as I planned for the next release.
Very cool @jalik
I understood your point, maybe you can separate the endpoint in another package that is imported by Local and GridFS (by example).
FYI, I'm looking for better solutions than CollectionFS to use in the project Rocket.Chat https://github.com/RocketChat/Rocket.Chat
@rodrigok, Ignore my first comment, now any requested file will be available directly through the Meteor app, this allow devs to apply security checks and decide when to allow or not the access to a file, thing we could not do if the file URL was pointing to another service directly.. this feature is available in the v0.2.2 by using the onRead(fileId, request, response) method.
https://github.com/jalik/jalik-ufs-local/blob/master/ufs-local.js#L119-L181
This code that creates the HTTP url to download the file seems to be in the wrong package, should be in a standalone package or in the core package IMHO.