Skip to content

Commit 3d3be9c

Browse files
authored
Update README.rst
1 parent 8e5ed49 commit 3d3be9c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,26 @@ for a boolean method that checks the validation use ``matches``
9999
if Png.matches(a_path_to_a_file):
100100
... handle case ...
101101
102+
Format Identification
103+
---------------------
104+
105+
There are 2 main functions that can be used for format identification
106+
107+
* ``fileformats.core.from_mime``
108+
* ``fileformats.core.find_matching``
109+
110+
``from_mime``
111+
~~~~~~~~~~~~~
112+
113+
As the name suggests, this function is used to return the FileFormats class corresponding to a given `MIME <https://www.iana.org/assignments/media-types/media-types.xhtml>`__ string. All non-vendor official MIME-types are supported. Non-official types can be loaded using the `application/x-name-of-type`
114+
form as long as the name of the type is unique amongst all installed format types. To avoid name clashes between different extension types, the "MIME-like" string can be used instead, where informal registries corresponding to the fileformats extension namespace are used instead, e.g. `medimage/nifti-gz` or `datascience/hdf5`.
115+
116+
``find_matching``
117+
~~~~~~~~~~~~~~~~~
118+
119+
Given a set of file-system paths, by default, ``find_matching`` will iterate through all installed fileformats classes and return all that validate successfully (formats without any specific constraints are excluded by default). The potential candidate classes can be restricted by using the `candidates` keyword argument.
120+
121+
102122
Format Conversion
103123
-----------------
104124

0 commit comments

Comments
 (0)