List Recv
4/27/2006 3:35:00 PM
A very neat and useful feature of Ruby is:
contents = File.read(filename)
Unfortunately, there's no simple way to do this for *binary* files in
OS's that differentiate (ie Windows). Or is there a similar method
which does the same in binary mode?
A simple workaround is to:
class IO
def self.readbin(filename)
self.class.open(filename, 'rb') { |f| f.read }
end
end
Could I suggest that the maintainers put it in the std-lib?