End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
FileUtils.compare_stream
compare_stream(a, b)
lib/fileutils.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/fileutils.rb, line 1548
def compare_stream(a, b)
bsize = fu_stream_blksize(a, b)
sa = String.new(capacity: bsize)
sb = String.new(capacity: bsize)
begin
a.read(bsize, sa)
b.read(bsize, sb)
return true if sa.empty? && sb.empty?
end while sa == sb
false
end
Returns true if the contents of streams a and b are identical, false otherwise.
Arguments a and b should be interpretable as a path.
Related: FileUtils.compare_file.