Module Base64_rfc2045
Decode
type src=[|`Manual|`Channel of Stdlib.in_channel|`String of string]The type for input sources. With a
`Manualsource the client must provide input withsrc.
val src : decoder -> Stdlib.Bytes.t -> int -> int -> unitsrc d s j lprovidesdwithlbytes to read, starting atjins. This byte range is read by calls todecodewithduntil`Awaitis returned. To signal the end of input, call the function withl = 0.
val decode : decoder -> decodedecode dis:`Awaitifdhas a`Manualinput source and awaits for more input. The client must usesrcto provide it.`Endif the end of input was reached`Malformed bytesif thebytessequence is malformed according to the decoded base64 encoding scheme. If you are interested in a best-effort decoding, you can still continue to decode after an error until the decode synchronizes again on valid bytes.`Flush dataif adatasequence value was decoded.`Wrong_paddingif decoder retrieve a wrong padding at the end of the input.
Note. Repeated invocation always eventually returns
`End, even in case of errors.
val decoder_byte_count : decoder -> intdecoder_byte_count dis the number of characters already decoded ond(included malformed ones). This is the lastdecode's end output offset counting from beginning of the stream.
val decoder_dangerous : decoder -> booldecoder_dangerous dreturnstrueif encoded input does not respect the 80-columns rule. If your are interested in a best-effort decoding you can still continue to decode even ifdecoder_dangerous dreturnstrue. Nothing grow automatically internally in this state.
type dst=[|`Channel of Stdlib.out_channel|`Buffer of Stdlib.Buffer.t|`Manual]The type for output destinations. With a
`Manualdestination the client must provide output storage withdst.
val encode : encoder -> encode -> [ `Ok | `Partial ]encode e v: is`Partialiffehas a`Manualdestination and needs more output storage. The client must usedstto provide a new buffer and then callencodewith`Awaituntil`Okis returned.`Okwhen the encoder is ready to encode a new`Charor`End
For
`Manualdestination, encoding`Endalways return`Partial, the client should continue as usual with`Awaituntil`Okis returned at which pointdst_remencoderis guaranteed to be the size of the last provided buffer (i.e. nothing was written).Raises.
Invalid_argumentif a`Charor`Endis encoded after a`Partialencode.