RobR wrote: > I'd like to decompress the contents of: > http://host.com/file.zip > > in memory without having to download the file (e.g. `wget`) first. > Suggestions?
"Without having to download the file first" is an example of "premature optimization". It is the root of all evil. On any OS configured to be a server (as opposed to a wrist watch, for example) all memory and files map each other virtually. If you Net::HTTP read() that file to a file location, the OS will generally reserve a slot on the hard drive, then put the file into its matching memory location. In the next split microsecond, your code reads that file and unzips it, using only the memory image. If you then delete the file, it may never reach the hard drive. By that analysis, if you write simple code that downloads the file and hits it with common tools, you can finish your feature faster. However, there are also situations where you _don't_ know which option is faster. Write the simpler code anyway, and then profile it to identify the real bottlenecks. They are invariably _not_ the places you would have guessed. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---