@@ -52,7 +52,22 @@ the information :func:`init` sets up.
5252 are also recognized.
5353
5454 .. versionchanged :: 3.8
55- Added support for url being a :term: `path-like object `.
55+ Added support for *url * being a :term: `path-like object `.
56+
57+ .. deprecated :: 3.13
58+ Passing a file path instead of URL is :term: `soft deprecated `.
59+ Use :func: `guess_file_type ` for this.
60+
61+
62+ .. function :: guess_file_type(path, *, strict=True)
63+
64+ .. index :: pair: MIME; headers
65+
66+ Guess the type of a file based on its path, given by *path *.
67+ Similar to the :func: `guess_type ` function, but accepts a path instead of URL.
68+ Path can be a string, a bytes object or a :term: `path-like object `.
69+
70+ .. versionadded :: 3.13
5671
5772
5873.. function :: guess_all_extensions(type, strict=True)
@@ -61,7 +76,7 @@ the information :func:`init` sets up.
6176 return value is a list of strings giving all possible filename extensions,
6277 including the leading dot (``'.' ``). The extensions are not guaranteed to have
6378 been associated with any particular data stream, but would be mapped to the MIME
64- type *type * by :func: `guess_type `.
79+ type *type * by :func: `guess_type ` and :func: ` guess_file_type ` .
6580
6681 The optional *strict * argument has the same meaning as with the :func: `guess_type ` function.
6782
@@ -72,8 +87,8 @@ the information :func:`init` sets up.
7287 return value is a string giving a filename extension, including the leading dot
7388 (``'.' ``). The extension is not guaranteed to have been associated with any
7489 particular data stream, but would be mapped to the MIME type *type * by
75- :func: `guess_type `. If no extension can be guessed for * type *, `` None `` is
76- returned.
90+ :func: `guess_type ` and :func: ` guess_file_type `.
91+ If no extension can be guessed for * type *, `` None `` is returned.
7792
7893 The optional *strict * argument has the same meaning as with the :func: `guess_type ` function.
7994
@@ -238,6 +253,14 @@ than one MIME-type database; it provides an interface similar to the one of the
238253 the object.
239254
240255
256+ .. method :: MimeTypes.guess_file_type(path, *, strict=True)
257+
258+ Similar to the :func: `guess_file_type ` function, using the tables stored
259+ as part of the object.
260+
261+ .. versionadded :: 3.13
262+
263+
241264 .. method :: MimeTypes.guess_all_extensions(type, strict=True)
242265
243266 Similar to the :func: `guess_all_extensions ` function, using the tables stored
0 commit comments