This is available as File\open_read_only in the www repository.
File\open_read_only
namespace HH\Lib\File; function open_read_only( string $path, ): CloseableReadHandle;
string $path
CloseableReadHandle