Display the size and format of a file attached to an article
Try getSize and getMimeType in your my_theme.theme as in the example below 

function my_theme_preprocess_node(&amp;$vars) {
  $node = $vars['node'];
  $type = $node-&gt;getType();
  if( $type == "article" &amp;&amp; $node-&gt;hasField('field_file')){
      //next gets FieldItemList
      //$file = $node-&gt;get('field_file');  

      //you need get the file entity
      $file = $node-&gt;get('field_file')-&gt;entity;
      $vars["size"] = $file-&gt;getSize();
      $vars["type"] = $file-&gt;getMimeType();     
  }
}