Module Js_of_ocaml_compiler.Base64
val default_alphabet : alphabetA 64-character alphabet specifying the regular Base64 alphabet.
val uri_safe_alphabet : alphabetA 64-character alphabet specifying the URI- and filename-safe Base64 alphabet.
val make_alphabet : string -> alphabetMake a new alphabet.
val length_alphabet : alphabet -> intReturns length of the alphabet, should be 64.
val alphabet : alphabet -> int arrayReturns the alphabet.
val decode_exn : ?pad:bool -> ?alphabet:alphabet -> ?off:int -> ?len:int -> string -> stringdecode_exn ?off ?len sdecodeslenbytes (defaults toString.length s - off) of the stringsstarting fromoff(defaults to0) that is encoded in Base64 format. Will leave trailing NULLs on the string, padding it out to a multiple of 3 characters.alphabetdefaults todefault_alphabet.pad = truespecifies to check ifsis padded or not, otherwise, it raises an exception.Decoder can fail when character of
sis not a part ofalphabetor is notpaddingcharacter. If input is not padded correctly, decoder does the best-effort but it does not ensuredecode_exn (encode ~pad:false x) = x.- raises if
Invalid_argument
sis not a valid Base64 string.
val decode_sub : ?pad:bool -> ?alphabet:alphabet -> ?off:int -> ?len:int -> string -> (sub, [ `Msg of string ]) resultSame as
decode_exnbut it returns a result type instead to raise an exception. Then, it returns asubstring. Decoded input(str, off, len)will starting tooffand will havelenbytes - by this way, we ensure to allocate only one time result.
val decode : ?pad:bool -> ?alphabet:alphabet -> ?off:int -> ?len:int -> string -> (string, [ `Msg of string ]) resultSame as
decode_exn, but returns an explicit error messageresultif it fails.
val encode : ?pad:bool -> ?alphabet:alphabet -> ?off:int -> ?len:int -> string -> (string, [ `Msg of string ]) resultencode sencodes the stringsinto base64. Ifpadis false, no trailing padding is added.paddefaults totrue, andalphabettodefault_alphabet.encodefails whenoffandlendo not designate a valid range ofs.
val encode_string : ?pad:bool -> ?alphabet:alphabet -> string -> stringencode_string sencodes the stringsinto base64. Ifpadis false, no trailing padding is added.paddefaults totrue, andalphabettodefault_alphabet.