public static function sendfile($outfd, $path, $cb, $startCb = null, $offset = 0, $length = null, $pri = EIO_PRI_DEFAULT)
{
$cb = CallbackWrapper::forceWrap($cb);
if (!self::$supported) {
$cb($path, false);
return false;
}
$noncache = true;
FileSystem::open($path, 'r!', function ($file) use($cb, $noncache, $startCb, $path, $pri, $outfd, $offset, $length) {
if (!$file) {
$cb($path, false);
return;
}
$file->sendfile($outfd, function ($file, $success) use($cb, $noncache) {
$cb($file->path, $success);
if ($noncache) {
$file->close();
}
}, $startCb, $offset, $length, $pri);
}, $pri);
return true;
}