From: Alex Young Date: 2007-03-25T20:18:13+09:00 Subject: Re: Read only a few bytes from file toulax@gmail.com wrote: > Is there any way to read only a determined amount of bytes from a > specific file? I actually want to do that to a URL, but I assume the > procedure would be the same. > > If someone could at least point me to the right direction that would > be great! If you want to read from the start of the file, File#read takes a number of bytes as a parameter: irb(main):015:0> File.open('/usr/share/dict/words'){|f| f.read(50)} => "\nA\nA's\nAOL\nAOL's\nAachen\nAachen's\nAaliyah\nAaliyah's" -- Alex