package telegraml

  1. Overview
  2. Docs

Used for handling, loading, and sending outgoing files in messages

val load : string -> string Lwt.t

Loads a file (by filename) and returns the raw bytes inside of it

Used to format data as HTTP multipart/form-data Takes:

  • A list of fields to be included in the form data as a pair of strings (name, value)
  • A tuple of:

    • The name of the data field
    • The path to the file/the file's name
    • The mime type of the file
  • A string to be used as a boundary to split different parts of the data; ideally, this text should not be present in the raw data of the file being sent
  • returns

    The formatted string to use as the HTTP body (make sure to correctly format the headers for multipart/form-data)

val multipart_body : (string * string) list -> (string * string * string) -> string -> string Lwt.t

Used to format data as HTTP multipart/form-data Takes:

  • A list of fields to be included in the form data as a pair of strings (name, value)
  • A tuple of:

    • The name of the data field
    • The path to the file/the file's name
    • The mime type of the file
  • A string to be used as a boundary to split different parts of the data; ideally, this text should not be present in the raw data of the file being sent
  • returns

    The formatted string to use as the HTTP body (make sure to correctly format the headers for multipart/form-data)