2008/5/20, Phillip Gawlowski <cmdjackryan / googlemail.com>: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > 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. > > Caching saves CPU and memory. :) > > - -- > Phillip Gawlowski > Twitter: twitter.com/cynicalryan > Blog: http://justarubyist.blogspot.com > > 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 > > iEYEARECAAYFAkgzP6sACgkQbtAgaoJTgL8o4ACfcp/wTC7QT52nXFDre9I+YRck > iBEAn1x/BtR99VLngUBmvOSmD3EN8mCk > =L8uK > -----END PGP SIGNATURE----- > > 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