public function file($path, array $options = [])
    {
        deprecationWarning(
            'Response::file() is deprecated. ' .
            'Use withFile() instead.'
        );

        $file = $this->validateFile($path);
        $options += [
            'name' => null,
            'download' => null
        ];

        $extension = strtolower($file->ext());
        $download = $options['download'];
        if ((!$extension || $this->type($extension) === false) && $download === null) {
            $download = true;
        }

        $fileSize = $file->size();
        if ($download) {
            $agent = env('HTTP_USER_AGENT');

            if (preg_match('%Opera(/| )([0-9].[0-9]{1,2})%', $agent)) {
                $contentType = 'application/octet-stream';
            } elseif (preg_match('/MSIE ([0-9].[0-9]{1,2})/', $agent)) {
                $contentType = 'application/force-download';
            }

            if (!empty($contentType)) {
                $this->type($contentType);
            }
            if ($options['name'] === null) {
                $name = $file->name;
            } else {
                $name = $options['name'];
            }
            $this->download($name);
            $this->header('Content-Transfer-Encoding', 'binary');
        }

        $this->header('Accept-Ranges', 'bytes');
        $httpRange = env('HTTP_RANGE');
        if (isset($httpRange)) {
            $this->_fileRange($file, $httpRange);
        } else {
            $this->header('Content-Length', $fileSize);
        }

        $this->_file = $file;
        $this->stream = new Stream($file->path, 'rb');
    }