Method: File.size

Defined in:
file.c

.size(file_name) ⇒ Integer

Returns the size of file_name.

file_name can be an IO object.

Returns:



2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
# File 'file.c', line 2201

static VALUE
rb_file_s_size(VALUE klass, VALUE fname)
{
    struct stat st;

    if (rb_stat(fname, &st) < 0) {
	int e = errno;
	FilePathValue(fname);
	rb_syserr_fail_path(e, fname);
    }
    return OFFT2NUM(st.st_size);
}