Examines a file entity and returns appropriate content headers for download.
Drupal\file\File $file: A file entity.
An associative array of headers, as expected by \Symfony\Component\HttpFoundation\StreamedResponse.
function file_get_content_headers(File $file) {
$name = mime_header_encode($file->filename);
$type = mime_header_encode($file->filemime);
return array(
'Content-Type' => $type,
'Content-Length' => $file->filesize,
'Cache-Control' => 'private',
);
}