1 (* Copyright (C) 2004-2005, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://helm.cs.unibo.it/
26 (** Transparent handling of local/remote getter resources.
27 * Configuration of this module are prefix mappings (see
28 * Http_getter_env.prefixes). All functions of this module take as input an URI,
29 * resolve it using mappings and act on the resulting resource which can be
30 * local (file:/// scheme or relative path) or remote via HTTP (http:// scheme).
32 * Each resource could be either compressed (trailing ".gz") or non-compressed.
33 * All functions of this module will first loook for the compressed resource
34 * (i.e. the asked one ^ ".gz"), falling back to the non-compressed one.
36 * All filenames returned by functions of this module exists on the filesystem
37 * after function's return.
39 * Almost all functions may raise Resource_not_found, the following invariant
40 * holds: that exception is raised iff exists return false on a given resource
43 exception Resource_not_found of string * string (** method, uri *)
45 (** @return a list of string where dir are returned with a trailing "/" *)
46 val ls: string -> string list
49 (** @return the filename of the resource corresponding to a given uri. Handle
50 * download and caching for remote resources.
51 * @param find if set to true all matching prefixes will be searched for the
52 * asked resource, if not only the best matching prefix will be used. Note
53 * that the search is performed only if the asked resource is not found in
54 * cache (i.e. to perform the find again you need to clean the cache).
55 * Defaults to false *)
56 val filename: ?find:bool -> string -> string
58 (** only works for local resources
59 * if both compressed and non-compressed versions of a resource exist, both of
61 val remove: string -> unit
63 val exists: string -> bool
64 val resolve: string -> string
66 val clean_cache: unit -> unit