How can you display document file sizes next to a media link button?
function HOOK_preprocess_file_link(&amp;$variables) {
  if (isset($variables['file'])) {
    $variables['fileLinkDisplay'] = [
      'fileSize' =&gt; $variables['file']
        -&gt;getSize(),
      'fileSizeFormatted' =&gt; format_size($variables['file']
        -&gt;getSize()),
    ];
  }
}


{{ fileLinkDisplay.fileSize }}and {{ fileLinkDisplay.fileSizeFormatted }} will be available in your template.

PS: if it works then you can more filter to restrict to the content type and field you want applied for.

Additionally, there is a module that show the size https://www.drupal.org/project/field_formatter_file_size


  Field Formatter File Size is a field formatter to display the file
  size.