سؤال

Im mounting an samba share from our Windows fileserver to our webserver so that the employees can transfer data to our fileexchange portal via their samba shares.

I want to stream these files via the send_file method which doesnt work well with big files. It seems that the send_file method waits till it has loaded the complete file which can take a very long time over the 100mbit network.

By default the :stream option is set to true and I also set it to true manually but it doesnt help. The method always waits till the whole file is loaded. I think the problem is that Im trying to stream from the samba share. Is there any mounting option that could help me out?

هل كانت مفيدة؟

المحلول

Due to obscure nature of MS technologies and protocols and unknowns regarding your system setup, rails version etc, I kinda have a feeling you might not get the answer you are looking for.

So, if this unwanted case happens, let me give a couple of alternatives...

Alternative 1

Set up a web server on the SMB host to serve the files, mount the folder in apache and stream them over HTTP directly to the client without the webapp as the middleman

Alternative argh :-(

If all else fails,

considering you have a relatively small number of users and high network latency it might prove a decent enough choice to simply stream file contents using regular File.open (How do I read/write binary files?) and Rails' inbuilt streaming (this will depend on your rails version, Rails 4 should handle this well, Rails 3 is doable too)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top