Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Pathname#binwrite

(::String, ?::Integer offset, ?mode: ::Integer | ::String, ?flags: ::Integer, ?external_encoding: ::encoding, ?internal_encoding: ::encoding, ?encoding: ::encoding, ?textmode: ::boolish, ?binmode: ::boolish, ?autoclose: ::boolish, ?invalid: :replace ?, ?undef: :replace ?, ?replace: ::String, ?fallback: ::Hash[::String, ::String] | ::Proc | ::Method, ?xml: :text | :attr, ?universal_newline: true, ?cr_newline: true, ?crlf_newline: true) -> ::Integer
binwrite(string, offset = 0, **opts) → nonnegative_integer

Behaves like write, except that the file is opened in binary mode with ASCII-8BIT encoding.

See also #binread #birthtime #basename #blockdev? also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0