Can't flush I know why, but no fix

However, it might be worthwhile modifying open_uri to allow the asynchronous download and progress notification you want, and then submit a patch, so this can end up in the core code.

Thanks Harry! I took your advice. Its not quite asynchronous download, but what i did was add in a hook. So now you can do this:

require ‘open_uri’
progress_proc = proc { |b| print “Downloaded #{b} bytes so far.” }
open(url, progress_proc) { |f| print “Done” }

This of course will print many lines like:

Downloaded 1 bytes so far.
Downloaded 2 bytes so far.
Downloaded 3 bytes so far.
Downloaded 4 bytes so far.
Downloaded 5 bytes so far.

Done.

Not sure the exact count of bytes for each cycle. This really works well with Ruby/ProgressBar though (which moves back to the same line with each pass).

It probably could be made a tad more robust but I am pretty sure i covered all the base in the code. The this lib’s in the distribution of Ruby, so how/who do i give the new version to now?

-t0

However, it might be worthwhile modifying open_uri to allow the
asynchronous download and progress notification you want, and then
submit a patch, so this can end up in the core code.
Thanks Harry! I took your advice. Its not quite asynchronous download,
but what i did was add in a hook. So now you can do this:

It probably could be made a tad more robust but I am pretty sure i
covered all the base in the code. The this lib’s in the distribution of
Ruby, so how/who do i give the new version to now?

Create a patch file (diff -u, I think) and post it to ruby-core, along with
why you think it would be good to apply. (Not everyone on -core reads
-talk.)

-austin

···

On Fri, 14 Nov 2003 15:13:58 +0900, T. Onoma wrote:

austin ziegler * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.11.14
* 07.57.22