Is there any way to get the file contents on the server? I have a bunch of text files that I would like to do parsing on. I know I could go to where their stored and open them via the FS module, but if I decide to change where the file is stored I'd rather not have to update that.
Hello @davidworkman9 ,
I know I could go to where their stored and open them via the FS module
This is the right way.
if I decide to change where the file is stored I'd rather not have to update that
No idea how you can move a file without updating info at its references.
Hello @davidworkman9 ,
Have you solved this one?
Hi @dr-dimitru. I did. My use case is that in development, everything is stored locally, in production it's stored on S3. I already have the logic for whether to use S3 or a local directory in the meteor files collection definition and didn't want to duplicate that elsewhere when all I want is a buffer of the file on the server. So what I've done is I use request to the link generated from FileCollection.prototype.link to grab the file.
It's working, but I feel it's not the most optimal approach.
Hi @davidworkman9 ,
Why are you using request? Using s3.getObject method might be more optimal approach. wdyt?
I'm using request so that that code is the same in development & production, and if I ever move away from S3 for whatever reason it's seamless.
Can't argue on this. Your answer looks solid. Shall we close this one?
Sounds good, closed.