This is available as File\open_read_write
in the www repository.
namespace HH\Lib\File;
function open_read_write(
string $path,
WriteMode $mode = WriteMode::OPEN_OR_CREATE,
int $create_file_permissions = 420,
): CloseableReadWriteHandle;
string $path
WriteMode $mode = WriteMode::OPEN_OR_CREATE
int $create_file_permissions = 420