End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
File::Stat#size?
state.size → integer
file.c
View on GitHub ↗
static VALUE
rb_stat_s(VALUE obj)
{
off_t size = get_stat(obj)->st_size;
if (size == 0) return Qnil;
return OFFT2NUM(size);
}
Returns the size of stat in bytes.
Example
File.stat("testfile").size #=> 66