PHPDaemon\Applications\FileReaderRequest::file PHP Method

file() public method

public file ( $path )
$path
    public function file($path)
    {
        if (!\PHPDaemon\FS\FileSystem::$supported) {
            $this->out(file_get_contents(realpath($path)));
            $this->wakeup();
            return;
        }
        $job = $this->job;
        $job('readfile', function ($name, $job) use($path) {
            /** @var \PHPDaemon\Core\ComplexJob $job */
            $this->sendfile($path, function ($file, $success) use($job, $name) {
                $job->setResult($name);
            });
        });
    }