Create and save text files on server


#1

Dear all,

I have a meteor application, where the user can create wood plates with dimensions and drillings. When the user finish the creation of the plates, he has the possibility to create machine data (.asc file). After the end of the process it is possible to input the .asc files into the machine and the machine can start the production process. At the moment my solution is to download the asc files clientside without saving it on the server and I want to change it. I want to create and save the .asc files on server and give the user the possibility to download the data later. My problem is, I don’t know how to do something like this. I found a package “collectionFS”, which give me the possibilty to save files on server but up to now I didn’t find a solution how to create files and save them on server. For this reason I need help. Thanks for the answers.


#2

If it’s text just put it in mongo and if requested return it as a file to the user?


#3

Hallo lucfranken,

text file was for example, I will also have csv files. When the user will start to download the files, it must be an zip file.


#4

You don’t need a file on the server to send it out as a file:



So you can see the storage method different from the way the user will receive the file. You just send the right headers and the user will receive a “file” which is just something from for example a database or something just generated in code.


#5

Thank you lucfranken,

I will try it out.


#6

try this: https://atmospherejs.com/udondan/jszip last example


#7

Hello lucfranken,

you are right, i was so concentrated on files storage on server, that i forgot your proposed solution. I will store all necessary data in monogodb ans transform this data to files while zip process. It was a logical fault from my side. Many thanks.


#8

No problem good to hear you got grip on the issue!

Reason I came up with it is because I see it as a view. That same data might also be presented on a web page or in an api. So I would prefer to keep this formatting as a view.