diff --git a/core/modules/editor/src/Hook/EditorHooks.php b/core/modules/editor/src/Hook/EditorHooks.php
index 952dbff1db5e469820a3b252db5aa010239998a8..e58f922d2ae714847fa5069b203f366a3192c30f 100644
--- a/core/modules/editor/src/Hook/EditorHooks.php
+++ b/core/modules/editor/src/Hook/EditorHooks.php
@@ -319,7 +319,7 @@ public function fileDownload($uri): array|int|null {
       }
     }
     // Access is granted.
-    $headers = file_get_content_headers($file);
+    $headers = $file->getDownloadHeaders();
     return $headers;
   }
 
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 9c10140fa4ba6b7a6f0e0db718ff9696e2acbc95..120d553c5c6dd943642a94aa5e2f25d83bcb3ca6 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -35,13 +35,13 @@
  * @return array
  *   An associative array of headers, as expected by
  *   \Symfony\Component\HttpFoundation\StreamedResponse.
+ *
+ * @deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use Drupal\file\Entity\FileInterface::getDownloadHeaders() instead.
+ * @see https://www.drupal.org/node/3494172
  */
 function file_get_content_headers(FileInterface $file) {
-  return [
-    'Content-Type' => $file->getMimeType(),
-    'Content-Length' => $file->getSize(),
-    'Cache-Control' => 'private',
-  ];
+  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0.  Use Drupal\file\Entity\FileInterface::getDownloadHeaders() instead. See https://www.drupal.org/node/3494172', E_USER_DEPRECATED);
+  return $file->getDownloadHeaders();
 }
 
 /**
diff --git a/core/modules/file/src/Entity/File.php b/core/modules/file/src/Entity/File.php
index 0022fec6add1d1137c844ae4391483a74b0626e1..bc310eeb7f22c62bd9b81d4f085f323350e24652 100644
--- a/core/modules/file/src/Entity/File.php
+++ b/core/modules/file/src/Entity/File.php
@@ -300,4 +300,15 @@ protected function invalidateTagsOnSave($update) {
     Cache::invalidateTags($tags);
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function getDownloadHeaders(): array {
+    return [
+      'Content-Type' => $this->getMimeType(),
+      'Content-Length' => $this->getSize(),
+      'Cache-Control' => 'private',
+    ];
+  }
+
 }
diff --git a/core/modules/file/src/FileInterface.php b/core/modules/file/src/FileInterface.php
index 588009cb475b1e558bc93ccbc7c3f9a003948055..efa6627790fec8201ebd2581d04955b27f74d05d 100644
--- a/core/modules/file/src/FileInterface.php
+++ b/core/modules/file/src/FileInterface.php
@@ -142,4 +142,13 @@ public function setTemporary();
    */
   public function getCreatedTime();
 
+  /**
+   * Examines a file entity and returns content headers for download.
+   *
+   * @return array
+   *   An associative array of headers, as expected by
+   *   \Symfony\Component\HttpFoundation\StreamedResponse.
+   */
+  public function getDownloadHeaders(): array;
+
 }
diff --git a/core/modules/file/src/Hook/FileDownloadHook.php b/core/modules/file/src/Hook/FileDownloadHook.php
index 21086c5eb1144a99cc5ff3eb44911df1e25800dd..1dee2310d57fae2cb1fdb675fffcbb63564407c3 100644
--- a/core/modules/file/src/Hook/FileDownloadHook.php
+++ b/core/modules/file/src/Hook/FileDownloadHook.php
@@ -58,7 +58,7 @@ public function __invoke($uri): array|int|null {
       return -1;
     }
     // Access is granted.
-    return file_get_content_headers($file);
+    return $file->getDownloadHeaders();
   }
 
 }
diff --git a/core/modules/file/tests/file_test/src/Hook/FileTestHooks.php b/core/modules/file/tests/file_test/src/Hook/FileTestHooks.php
index 1f274d9ed0ab903275ed0285c8787288718592cc..267e2ada834cc0de08789bc953919226ebf976e8 100644
--- a/core/modules/file/tests/file_test/src/Hook/FileTestHooks.php
+++ b/core/modules/file/tests/file_test/src/Hook/FileTestHooks.php
@@ -38,7 +38,7 @@ public function fileDownload($uri): array|int|null {
     if (\Drupal::state()->get('file_test.allow_all', FALSE)) {
       $files = \Drupal::entityTypeManager()->getStorage('file')->loadByProperties(['uri' => $uri]);
       $file = reset($files);
-      return file_get_content_headers($file);
+      return $file->getDownloadHeaders();
     }
     FileTestHelper::logCall('download', [$uri]);
     return $this->getReturn('download');