You are here

public function DownloadController::downloadCompressedContent in Default Content Deploy 8

Return binary archive file for download.

Return value

\Symfony\Component\HttpFoundation\BinaryFileResponse

1 string reference to 'DownloadController::downloadCompressedContent'
default_content_deploy.routing.yml in ./default_content_deploy.routing.yml
default_content_deploy.routing.yml

File

src/Controller/DownloadController.php, line 58

Class

DownloadController
Returns responses for config module routes.

Namespace

Drupal\default_content_deploy\Controller

Code

public function downloadCompressedContent() {
  $this->deployManager
    ->compressContent();
  $path = $this->fileSystem
    ->getTempDirectory() . '/dcd/content.tar.gz';
  $headers = [
    'Content-Type' => 'application/tar+gzip',
    'Content-Description' => 'File Download',
    'Content-Disposition' => 'attachment; filename=content.tar.gz',
  ];
  return new BinaryFileResponse($path, 200, $headers);
}