Module Ftp

module Ftp: sig .. end
Functions for accessing files via ftp.
Author(s): Samuel Mimram

type ftp_connection 
An ftp connection to an ftp server.
type file_kind = 
| S_REG (*
regular file
*)
| S_DIR (*
directory
*)
| S_CHR (*
character device
*)
| S_BLK (*
block device
*)
| S_LNK (*
symbolic link
*)
| S_FIFO (*
named pipe
*)
| S_SOCK (*
socket
*)
Kind of a file.
type file_perm = int 
Permissions of a file.
type stats = {
   st_kind : file_kind; (*
kind of the file
*)
   st_perm : file_perm; (*
access rights
*)
   st_nlink : int; (*
number of links
*)
   st_un : string; (*
user name of the owner
*)
   st_gn : string; (*
group of the file's group
*)
   st_size : int; (*
size in bytes
*)
   st_mtime : float; (*
last modification time
*)
}
Properties of a file.
exception Unrecognised_format
The library could not stat correctly (the rfc of the ftp is infamous and does not specify the format of the output of the command LIST).
val connect : string -> int -> string -> string -> ftp_connection
connect server port login pass connects to the server named server on port port using the given login and password.
val disconnect : ftp_connection -> unit
Close a previously opened connection.
val set_passive : ftp_connection -> bool -> unit
Shoud the data connection be done in passive mode? (not used for now: the connection is always in passive mode).
val get_cur_dir : ftp_connection -> string
Get the directory we're currently in on the server.
val chdir : ftp_connection -> string -> unit
Change the current directory.
val chdir_up : ftp_connection -> unit
Change the current directory to the surrounding one.
val list_files : ftp_connection -> string -> string list
List all the files contained in a directory.
val get_file_size : ftp_connection -> string -> int
Get the size of a file (in bytes).
val ls : ftp_connection -> string -> (string * stats) list
List all the files contained in a directory, specifying its properties. WARNING: it does not always work yet (in fact it has only been tested with proftpd).
val stat : ftp_connection -> string -> stats
Get the properties of a file. If you only want its size, you should use get_size which is supposed to work better.
val get_file : ftp_connection -> string -> string -> unit
get_file fc src dst downloads the file src and stores it in dst. Warning: if the file already exists it is replaced.
val resume_file : ftp_connection -> string -> string -> int -> unit
resume_file fc src dst ofs downloads the file src starting at offset ofs and appends it to dst. Raises Not_found if the file does not already exists.
val get_file_portion : ftp_connection -> string -> int -> string -> int -> int -> int
get_file_portion fc src file_ofs buf ofs len downloads len octets of file src starting at position file_ofs and stores it in buf starting at position ofs. Returns the number of bytes actually read.
val mv : ftp_connection -> string -> string -> unit
mv fc src dst moves the file src to dst.
val rm : ftp_connection -> string -> unit
Remove a file.
val rmdir : ftp_connection -> string -> unit
Remove a directory.
val mkdir : ftp_connection -> string -> unit
Create a directory.
val nop : ftp_connection -> unit
Don't do anything :)
module type FILE = sig .. end
Type of the module providing high-level functions to access files via ftp.
module File: FILE 
High-level functions to access files via ftp.