System.IO.FileInfo.Types.ps1xml

<Types>
  <Type>
    <Name>System.IO.FileInfo</Name>
      <Members>
        <ScriptProperty>
          <Name>FileSize</Name>
          <GetScriptBlock>
              $bytes = $this.length;
 
              if ($bytes -gt 1TB) {
                return "{0:n2} TiB" -f ($bytes / 1TB);
              }
              if ($bytes -gt 1GB) {
                return "{0:n2} GiB" -f ($bytes / 1GB);
              }
              if ($bytes -gt 1MB) {
                return "{0:n2} MiB" -f ($bytes / 1MB);
              }
              if ($bytes -gt 1KB) {
                return "{0:n2} KiB" -f ($bytes / 1KB);
              }
 
              return "{0} B" -f $bytes;
          </GetScriptBlock>
      </ScriptProperty>
    </Members>
  </Type>
</Types>