szimek wrote:
| Hi,
|
| I got simple Rails app and I’d like to compress xml data and send it
| to the browser. I’m trying to use rubyzip for it, but i.e. the
| following usage:
|
| Zip::ZipFile.open(“file.zip”, Zip::ZipFile::CREATE) do |zip|
| zip.get_output_stream(“file.xml”) {|f| f.puts xml_data}
| end
|
| returns nil and creates file on the disk.
|
| Is it possible for rubyzip to return zipped data (or file) instead of
| writing it to the disk?
Write file to disk, give user link, delete file after a time, in case
the download has to be repeated.
Write first in an easy-to-understand pseudo-language; then translate
into
whatever language you have to use.
~ - The Elements of Programming Style (Kernighan & Plaugher)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
|
Write file to disk, give user link, delete file after a time, in case
whatever language you have to use.
Thanks.
I wanted to use Rails caching mechanisms (which I’m using i.e. to
cache generated XML datta to file). The result is the same - I got
zipped XML file on a disk - but by having raw data instead of a file
on a disk, I could have slightly cleaner code.
BTW. Is there some option to force rubyzip not to make temp files or
remove them after it’s done? I can remove them manually, but it would
be easier
Regards
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.