Module Fetch

module Fetch: sig .. end
Module fetch: universal fetcher. It currently handles samba, ftp and local files.
Author(s): Gaétan Richard, Samuel Mimram, Julien Cristau

type protocol = string 
exception Error of exn
exception Not_implemented
Operation not implemented
exception Unknown_protocol of protocol
Tried to use an unknown protocol
exception Bad_URI
URI provided was not syntaxicaly correct
type uri = string 
val supported_protocols : unit -> protocol list
val get_protocol : uri -> protocol
type open_flag = 
| O_RDONLY
| O_WRONLY
| O_RDWR
| O_CREAT
| O_TRUNC
Flags for opening files.
type seek_command = 
| SEEK_SET
| SEEK_CUR
| SEEK_END
Flags for seeking in files.
type file_perm = int 
The type of file access rights.
type file_descr 
The abstract type of file descriptors.
type file_kind = 
| S_REG
| S_DIR
val openfile : uri -> open_flag list -> file_perm -> file_descr
Open the named file with the given flags. Third argument is the permissions to give to the file if it is created. Return a file descriptor on the named file.
val close : file_descr -> unit
Close a file descriptor.
val read : file_descr -> string -> int -> int -> int
read fd buff ofs len reads len characters from descriptor fd, storing them in string buff, starting at position ofs in string buff.
Returns the number of characters actually read.
val write : file_descr -> string -> int -> int -> int
write fd buff ofs len writes... TODO
val lseek : file_descr -> int -> seek_command -> int
Set the current position for a file descriptor.
val ls : uri -> (uri * file_kind) list
List contents of a directory.
val basename : string -> string
Get the filename only in a full uri. For example basename "smb://babasse/tatu.mp3" returns "tatu.mp3".
val cp : uri -> uri -> unit
cp source dest copies the file source to dest (both arguments are uri).
val is_alive : uri -> bool
Is a server alive and available ?