Skip to content
This repository
Newer
Older
100644 46 lines (35 sloc) 1.576 kb
fccc6851 » MLstate
2011-06-21 Initial open-source release
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18
19
20 (* Type of imported mimetype database *)
21 type mimetype_database
22
23 exception MimeType_NotFound
24 exception Malformed
25 exception Open of string
26
27 (** Import mlstate the database.
28 It is stored in a xml file : $MLSTATELIBS/share/opa/mimetype_database.xml.
29 Takes in argumetns, the path of mlstatelibs directory.
30 The result of [mimetype_database] is memoized.
31
32 Raises [Malformed] if the xml file is malformed
33 *)
34 val mimetype_database : string Lazy.t -> mimetype_database
35
36 (** Like mimetype_database but with the specified file as database
37 (not defualt file in $MLSTATELIBS). *)
38 val get_mimetype_database : string -> mimetype_database
39
40 (** [get_mimetype] filename database return the mimetype of [filename]
41 * according [database].
42 *
43 * Raises [MimeType_NotFound] if no match is found
44 * Raises [Open <error>] if an error occurs during file's openning
45 *)
46 val get_mimetype : string -> mimetype_database -> string
Something went wrong with that request. Please try again.