One judo option would be:
ssh_options[:compression] = true
That will enable zlib compression for your entire SSH session
(assuming your SSH server is configured to allow zlib transport).
Aside from that, note that if you do the zlib compression of the data
using the Zlib ruby bindings, you'll need to make sure and uncompress
the files on the other end.
- Jamis
On Jun 3, 2008, at 9:45 AM, Sam Granieri wrote:
>
> Is there a way to wrap the file upload/download stream with zlib
> compression?
>
> I have to upload and download easily compressible log and csv files.
> They're huge, and take a while. I tried shelling out the compression
> task, but several coworkers are using windows (I'm on a Mac).
>
> I found Ruby has a built-in zlib library which compresses CSVs and log
> files very very nicely.
>
> If no one has already done this, I'm going to try to wrap my file
> upload
> and download tasks with Zlib compression.
>
> I'll then try to extract that functionality and move it into
> Capistrano
> itself.
>
> I'll share the results and propose it as a patch for further release
>
> Here's the uncompressed task I'm using as it stands now.
>
> desc "Upload CSV Files"
> task :copy do
> Dir.glob("lib/imports/**/*.csv") do |file|
> put(File.read(file), "#{shared_path}/#{file}")
> end
> end
>
> What I'm writing now is
> desc "Upload CSV Files"
> task :copy do
> Dir.glob("lib/imports/**/*.csv") do |file|
> put(Deflate.deflate(File.read(file)), "#{shared_path}/#{file}")
> # write a rake task that runs zlib inflate on the file
> end
> end
>
> Here's the syntax I'm shooting for.
>
> desc "Upload CSV Files"
> task :copy do
> Dir.glob("lib/imports/**/*.csv") do |file|
> put(File.read(file), "#{shared_path}/#{file}", :compress=>:zlib)
> end
> end
>
> I hope this helps!
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---