M
Michael Schuerig
I need to build a Zip-Archive with a unique name that is served by
Apache using its X-SendFile mechanism.
Tempfile doesn't appear to be suitable in this case as it unlinks its
managed file when the Tempfile object is finalized. In my current, wrong
code, I'm using Tempfile and the file is not deleted prematurely, but I
take this to be no more than luck.
There are two processes involved, the ruby process (Rails, actually)
writing the file and apache delivering it. Ruby only passes the file's
path to apache. The file's life has to be independent of the ruby
process from then on (and I have to delete it externally).
I could (ab)use Tempfile to write code like this, but that doesn't
strike me as very elegant
tf = Tempfile.new(['archive-', '.zip'])
tempname = tf.path
tf.close!
Is there a nicer way?
Michael
Apache using its X-SendFile mechanism.
Tempfile doesn't appear to be suitable in this case as it unlinks its
managed file when the Tempfile object is finalized. In my current, wrong
code, I'm using Tempfile and the file is not deleted prematurely, but I
take this to be no more than luck.
There are two processes involved, the ruby process (Rails, actually)
writing the file and apache delivering it. Ruby only passes the file's
path to apache. The file's life has to be independent of the ruby
process from then on (and I have to delete it externally).
I could (ab)use Tempfile to write code like this, but that doesn't
strike me as very elegant
tf = Tempfile.new(['archive-', '.zip'])
tempname = tf.path
tf.close!
Is there a nicer way?
Michael