How can create a download counter? How can tracks downloads of private files attached to nodes via the core upload or contributed filefield modules for custom content type, I created a file field and I simply want to count the number of times have been downloaded this file and display this count number in node template?

My Project purpose:


Upload a file as Admin, or any authenticated user 
Store the file in a private directory (But accessible by public
users)
Allow the all people or anonymous users to download the files.


These are some details about my content type module.


Module name: My Module
Content type name: My Content
Field Type: File
Display Format: URL to file (or Generic)
Field name: field_file


I know that there are some module like: 


File download count
Download Count
AJAX Download Counter


For drupal 7, but seem  none of them work in drupal 8. 

Thanks for any help.
The only Drupal-centric of doing this is by making sure your content type is utilizing the Private files directory for your file field. Otherwise, downloads are served by the web server.

When private file storage is utilized, this enables Drupal as the file download gatekeeper through its /system/files/{filepath} route. When the controller for the download route is called, it evokes hook_file_download() which can be used to store your ongoing file download count. 

For example a custom module could implement:

/**
 * Implements hook_file_download().
 */
function MYMDOULE_file_download($uri) {
  // @TODO: Store/Increment count for unique $uri.
}


Then reference the count when building variables for your node template:

/**
 * Implements hook_preprocess_node().
 */
function MYTHEME_preprocess_node(array &amp;$variables) {
  if (isset($variables['node']-&gt;field_MYFILE_FIELD)) {
    $uri =  $variables['node']-&gt;field_MYFILE_FIELD-&gt;entity-&gt;getFileUri();
  } else {
    $uri = '';
  }
  // @TOOD: lookup count for $uri and inject it into
  // $variables['field_MYFILE_FIELD_count'] for display
}