Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
Gem.write_binary
(::String path, ::String data) -> ::Integer
write_binary(path, data)
lib/rubygems.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/rubygems.rb, line 782
def self.write_binary(path, data)
File.binwrite(path, data)
rescue Errno::ENOSPC
# If we ran out of space but the file exists, it's *guaranteed* to be corrupted.
File.delete(path) if File.exist?(path)
raise
end
Safely write a file in binary mode on all platforms.