Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

IO.binread

IO.binread(command, length = nil, offset = 0) → string or nil
IO.binread(path, length = nil, offset = 0) → string or nil

Behaves like IO.read, except that the stream is opened in binary mode with ASCII-8BIT encoding.

When called from class IO (but not subclasses of IO), this method has potential security vulnerabilities if called with untrusted input; see Command Injection.

See also .binwrite .console also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0