[Mechanize-users] posting large files

Ding, Howard Adrian
Thu, 13 Dec 2012 19:17:29 -0000

Hi,

I''m curious if there are any recommended ways to post large files
(directly, not through a form) with Mechanize. E.g. I have something like the
following:

    content = File.open(file_path, ''rb'') { |f| f.read }
    self.client.post(file_url(bit_file), content, ingest_headers(bit_file,
file_path, opts[:path]))

but this requires reading the entire content of the file into memory to make the
post.  I see that on the GET side there is a method called download which
appears to function like a GET but to write the response body directly to a file
without having to have it all in memory at once, and I guess I''m
looking to see if there is anything similar for posting, as I may come up
against situations where I need to post files that are significantly larger than
my machines memory.

Thanks,
Howard

Howard Ding
Visiting Research Programmer
135 Grainger Engineering Library
217-300-1763 / hding2 at illinois.edu

-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://rubyforge.org/pipermail/mechanize-users/attachments/20121213/a620bcec/attachment.html>