Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

class method

IO.binwrite

(::String name, ::_ToS string, ?::Integer offset, ?mode: ::String mode) -> ::Integer
IO.binwrite(path, string, offset = 0) → integer

Behaves like IO.write, 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 .binread .console .copy_stream also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0