package aws-s3

  1. Overview
  2. Docs

S3 commands



type error =
  1. | Redirect of Util.region
  2. | Throttled
  3. | Unknown of int * string
  4. | Not_found
type nonrec 'a result = ('a, error) Core.result Compat.Deferred.t
type 'a command = ?scheme:[ `Http | `Https ] -> ?credentials:Credentials.t -> ?region:Util.region -> 'a
module Ls : sig ... end
module Delete_multi : sig ... end
type range = {
  1. first : int option;
  2. last : int option;
val put : (?content_type:string -> ?content_encoding:string -> ?acl:string -> ?cache_control:string -> bucket:string -> key:string -> data:string -> unit -> Core.Caml.Digest.t result) command

Upload key to bucket. Returns the etag of the object. The etag is the md5 checksum (RFC 1864)

val get : (?range:range -> bucket:string -> key:string -> unit -> string result) command

Download key from s3 in bucket If range is specified, only a part of the file is retrieved.

  • If first is None, then start from the beginning of the object.
  • If last is None, then get to the end of the object. Scheme defaults to http. If you are uploading across the internet. to use https, please make sure that you have enabled ssl for cohttp (opam package tls or lwt_ssl for lwt or async_ssl for async)
val delete : (bucket:string -> key:string -> unit -> unit result) command

Delete key from bucket.

val delete_multi : (bucket:string -> objects:Delete_multi.objekt list -> unit -> Delete_multi.result result) command

Delete multiple objects from bucket.

The result will indicate which items failed and which are deleted. If an item is not found it will be reported as successfully deleted.

val ls : (?continuation_token:string -> ?prefix:string -> bucket:string -> unit -> Ls.t) command

List contents in bucket

Aws will return upto 1000 keys per request. If not all keys are returned, the function will return a continuation.

module Multipart_upload : sig ... end
val retry : ?region:Util.region -> retries:int -> f: (?region:Util.region -> unit -> ('a, error) Core.Result.t Compat.Deferred.t) -> unit -> ('a, error) Core.Result.t Compat.Deferred.t

Helper function to handle error codes. The function handle redirects and throttling.


Innovation. Community. Security.