Skip to content

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

class method

File.empty?

(::string | ::_ToPath | ::IO file_name) -> bool
File.zero?(file_name) → true or false

Returns true if the named file exists and has a zero size.

file_name can be an IO object.