Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Pathname#binread
pathname.binread([length [, offset]]) → string
ext/pathname/pathname.c
View on GitHub ↗
static VALUE
path_binread(int argc, VALUE *argv, VALUE self)
{
VALUE args[3];
int n;
args[0] = get_strpath(self);
n = rb_scan_args(argc, argv, "02", &args[1], &args[2]);
return rb_funcallv(rb_cFile, id_binread, 1+n, args);
}
Returns all the bytes from the file, or the first N if specified.
See File.binread.