Display the size and format of a file attached to an article I'm trying to display the format and size of a file attached to an article. Its system name is field_file. 

So far, I've succeeded to load an article in my my_theme.theme file and the field_file field attached to it:

$article = Node::load($article_nid);
$variables['file'] = $article-&gt;get('field_file');

then use its uri in a twig file: 
{{file_url(file.entity.fileuri)}}

Now I'm trying to display its format and size. I tried {{file.entity.format}} and {{file.entity.filesize}} without success.

Does anyone have a clue how to do it? I'm still new to Drupal plugins and entities.
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();     
  }
}