package uwt

  1. Overview
  2. Docs
include Fs_functions with type 'a t := 'a Lwt.t
include sig ... end
type uv_open_flag = Fs_types.uv_open_flag =
  1. | O_RDONLY
  2. | O_WRONLY
  3. | O_RDWR
  4. | O_NONBLOCK
    (*

    Unix only, ignored otherwise

    *)
  5. | O_CREAT
  6. | O_EXCL
  7. | O_TRUNC
  8. | O_APPEND
  9. | O_NOCTTY
    (*

    Unix only, ignored otherwise

    *)
  10. | O_DSYNC
    (*

    only supported on some Unix platforms, ignored otherwise

    *)
  11. | O_SYNC
    (*

    only supported on some Unix platforms, ignored otherwise

    *)
  12. | O_RSYNC
    (*

    only supported on some Unix platforms, ignored otherwise

    *)
  13. | O_TEMPORARY
    (*

    windows only, ignored on Unix

    *)
  14. | O_SHORT_LIVED
    (*

    windows only, ignored on Unix

    *)
  15. | O_SEQUENTIAL
    (*

    windows only, ignored on Unix

    *)
  16. | O_RANDOM
    (*

    windows only, ignored on Unix

    *)

O_CLOEXEC and O_SHARE_DELETE, O_SHARE_WRITE, O_SHARE_READ don't exist, because these flags are unconditionally added by libuv, if the platform supports them.

type file_kind = Fs_types.file_kind =
  1. | S_REG
  2. | S_DIR
  3. | S_CHR
  4. | S_BLK
  5. | S_LNK
  6. | S_FIFO
  7. | S_SOCK
  8. | S_UNKNOWN
type access_permission = Fs_types.access_permission =
  1. | Read
  2. | Write
  3. | Exec
  4. | Exists
type stats = Fs_types.stats = {
  1. st_dev : int;
  2. st_kind : file_kind;
  3. st_perm : int;
  4. st_uid : int;
  5. st_gid : int;
  6. st_rdev : int;
  7. st_ino : int;
  8. st_size : int64;
  9. st_blksize : int;
  10. st_blocks : int;
  11. st_flags : int;
  12. st_gen : int;
  13. st_atime : int64;
  14. st_atime_nsec : int;
  15. st_mtime : int64;
  16. st_mtime_nsec : int;
  17. st_ctime : int64;
  18. st_ctime_nsec : int;
  19. st_birthtime : int64;
  20. st_birthtime_nsec : int;
}
val openfile : ?perm:int -> mode:uv_open_flag list -> string -> file Lwt.t
  • parameter perm

    defaults are 0o644

val read : ?pos:int -> ?len:int -> file -> buf:bytes -> int Lwt.t
  • parameter pos

    default is always zero

  • parameter len

    default is always the length of the string / array / Bytes.t

val read_ba : ?pos:int -> ?len:int -> file -> buf:buf -> int Lwt.t

_ba function are unsafe. Bigarrays are passed directly to libuv (no copy to c heap or stack).

val write : ?pos:int -> ?len:int -> file -> buf:bytes -> int Lwt.t
val write_string : ?pos:int -> ?len:int -> file -> buf:string -> int Lwt.t
val write_ba : ?pos:int -> ?len:int -> file -> buf:buf -> int Lwt.t
val close : file -> unit Lwt.t
val mkdir : ?perm:int -> string -> unit Lwt.t
  • parameter perm

    defaults are 0o777

val rmdir : string -> unit Lwt.t
val fsync : file -> unit Lwt.t
val fdatasync : file -> unit Lwt.t
val ftruncate : file -> len:int64 -> unit Lwt.t
val stat : string -> stats Lwt.t
val lstat : string -> stats Lwt.t
val fstat : file -> stats Lwt.t
val rename : src:string -> dst:string -> unit Lwt.t
  • parameter mode

    default S_Default

val mkdtemp : string -> string Lwt.t
val sendfile : ?pos:int64 -> ?len:nativeint -> dst:file -> src:file -> unit -> nativeint Lwt.t
  • parameter pos

    default 0

  • parameter len

    Nativeint.max_int

val utime : string -> access:float -> modif:float -> unit Lwt.t
val futime : file -> access:float -> modif:float -> unit Lwt.t
val access : string -> access_permission list -> unit Lwt.t
val chmod : string -> perm:int -> unit Lwt.t
val fchmod : file -> perm:int -> unit Lwt.t
val chown : string -> uid:int -> gid:int -> unit Lwt.t
val fchown : file -> uid:int -> gid:int -> unit Lwt.t
val scandir : string -> (file_kind * string) array Lwt.t
OCaml

Innovation. Community. Security.