Create a new file download response.

@param  \SplFileInfo|string  $file
@param  string  $name
@param  array   $headers
@return \Symfony\Component\HttpFoundation\BinaryFileResponse
181814
public static function download($file, $name = null, array $headers = array())
	{
		$response = new BinaryFileResponse($file, 200, $headers, true, 'attachment');

		if ( ! is_null($name))
		{
			return $response->setContentDisposition('attachment', $name);
		}

		return $response;
	}
165744
private function createBinaryFileResponse($file)
    {
        $response = new BinaryFileResponse($file);
        $response->headers->addCacheControlDirective('no-store', true);

        return $response;
    }
647611
public function download($name,$path){
        $ruta = $this->getFullPath().$path.$name;
        if( $this->config['debug'] ) $this->_log('$ruta - '.$ruta);
        if($this->validNameFile($name) && file_exists($ruta) && is_file($ruta) ){
            $response = new Response(file_get_contents($ruta));
            $response->headers->set('Content-Type', 'application/octet-stream');
            $d = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT,$name);
            $response->headers->set('Content-Disposition', $d);
            $response->send();
        }else{
            exit();
            // return null;
        }
    }
581555
public static function createFromFile($file) {
    $jsonConfig = json_decode(file_get_contents($file), true);
    return self::createFromConfig($jsonConfig);
  }
821031
public function fileDownload($file)
    {
        $response = new SymfonyResponse();

        $response->headers->set('Content-Disposition', 
            $response->headers->makeDisposition(
                ResponseHeaderBag::DISPOSITION_ATTACHMENT,
                $file
            )
        );

        return $response;
    }
744832
protected function createFileResource($name)
    {
        if ($this->getResource()->getPattern() && !preg_match($this->getResource()->getPattern(), $name)) {
            $this->files[$name] = 'skip';
        } else {
            $this->files[$name] = new FileResource($this->getResource()->getResource().'/'.$name);
        }
    }
1193204
public function addFile($name, $data) {
        $file = new File($this->getChild($name));
        $file->write($data);
        return $file;
    }
508486
protected function file($file, string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT): BinaryFileResponse
    {
        $response = new BinaryFileResponse($file);
        $response->setContentDisposition($disposition, null === $fileName ? $response->getFile()->getFilename() : $fileName);

        return $response;
    }
382542
protected function processFile($column, $file, $filename, $name = null)
  {
    if (!is_file($file)) {
      Exception::ThrowError(Exception::FILE_NOT_EXISTS, $file);
    }

    $ext  = strtolower(pathinfo($file, PATHINFO_EXTENSION));
    $size = filesize($file);

    $this->copyFile($file, $this->getFilesPath() . $filename);

    return $this->setSerialized(
      $column,
      array(
        'file'      => $filename,
        'extension' => $ext,
        'size'      => $size,
        'name'      => $name,
      )
    );
  }
371229
protected function setTranslationFile($name, array $headers)
    {
        $this->info('Set plugin translation file...');

        $textdomain = trim($headers['text_domain'], '\/ _-');
        $from = $this->path($name.'/languages/plugin-textdomain-en_US.po');
        $to = $this->path($name.'/languages/'.$textdomain.'-en_US.po');

        $this->files->move($from, $to);
    }
185301
protected function downloadFile($file, $name = null)
    {
        if(file_exists($file) && is_file($file) && is_readable($file)) {
            $mime_type = mime_content_type($file);
            if(in_array($mime_type, ['image/gif', 'image/jpeg', 'image/png'])) {
                $exif_type = exif_imagetype($file);
                $img_ext = image_type_to_extension($exif_type);
                if($img_ext == '.jpeg') {
                    $img_ext = '.jpg';
                }
                switch($exif_type) {
                    case IMAGETYPE_JPEG:
                        $img = imagecreatefromjpeg($file);
                        imagejpeg( $img, NULL, 100 ); 
                        break;
                    case IMAGETYPE_GIF:
                        $img = imagecreatefromgif($file);
                        imagegif( $img ); 
                        break;
                    case IMAGETYPE_PNG:
                        $img = imagecreatefrompng($file);
                        imagepng( $img, NULL, 100 ); 
                        break;
                }
                if(!$img) {
                }
                else {
                    imagedestroy( $img );
                }
                $headers[] = "Content-Type: $mime_type";
                if($name !== null && trim($name) !== '') {
                    //download - without it image will not be downloaded just displayed on broswer
                    if( (strlen($name)-strlen($img_ext)) !== strpos($name, $img_ext) ) {
                        $name .= $img_ext;
                    }
                    $headers[] = "Content-Disposition: attachment; filename=$name";
                }
                self::$instance->app->headers = $headers;
            }
        }
    }
654864
public function addAttachment($file, $name = null)
    {
        $this->_attachments[] = ['file' => $file, 'name' => $name ?: basename($file)];
        return $this;
    }
1142713
public function download($path, $name = null)
    {
        $fResponse = new FileResponse($path);
        return $fResponse->forceDownload($name);
    }
1016408
public function rename($file , $name , $path )
    {
		$new = $path.'/'.$name;
		
		return \Image::make( $file )->save($new);
	}
505637
public function create(FileResource $file)
    {
        $path = $this->buildUsersPath();
        $builder = (new MultipartStreamBuilder())->addResource($file->getName(), $file->getResource(), $file->getOptions());
        $headers = ['Content-Type' => sprintf('multipart/form-data; boundary="%s"', $builder->getBoundary())];

        return $this->postRaw($path, $builder->build(), $headers);
    }
832441
public function download($date, $filename = null, $headers = [])
    {
        if (is_null($filename)) {
            $filename = "laravel-{$date}.log";
        }

        $path = $this->filesystem->path($date);

        return response()->download($path, $filename, $headers);
    }
1112832
public function download(string $fileName = null, string $writerType = null, array $headers = [])
    {
        $fileName = $fileName ?? $this->fileName ?? null;

        if (null === $fileName) {
            throw new NoFilenameGivenException();
        }

        return $this->getExporter()->download(
            $this,
            $fileName,
            $writerType ?? $this->writerType ?? null,
            $headers
        );
    }