Functions -
mime
base64Decode | Decodes a given input with MIME specific Base64 encoding scheme. |
base64DecodeBlob | Decodes a given byte[] with Base64 encoding scheme. |
base64Encode | Encodes a given input with MIME specific Base64 encoding scheme. |
base64EncodeBlob | Encodes a given byte[] with Base64 encoding scheme. |
getContentDispositionObject | Given the Content-Disposition as a string, gets the ContentDisposition object with it. |
getMediaType | Given the Content-Type in string, gets the MediaType object populated with it. |
prepareDecodingErrorWithDetail | |
prepareEncodingErrorWithDetail |
base64Decode
(string | byte | ReadableByteChannel contentToBeDecoded, string charset)
returns string | byte | ReadableByteChannel | DecodeErrorDecodes a given input with MIME specific Base64 encoding scheme.
Parameters
- contentToBeDecoded string | byte | ReadableByteChannel
-
Content that needs to be decoded can be of type
string
,byte[]
orio:ReadableByteChannel
- charset string - utf-8
-
Charset to be used. This is used only with the string input
-
Return Type
(string | byte | ReadableByteChannel | DecodeError) If the given input is of type string, a decoded
string
is returned. If the given input is of type byte[], a decodedbyte[]
is returned. If the given input is of type io:ReadableByteChannel, a decodedio:ReadableByteChannel
is returned. In case of errors, anDecodeError
record is returned.
Decodes a given byte[] with Base64 encoding scheme.
Parameters
- valueToBeDecoded byte
-
Content that needs to be decoded
-
Return Type
(byte | DecodeError) A decoded
byte[]
. In case of errors, anDecodeError
record is returned
base64Encode
(string | byte | ReadableByteChannel contentToBeEncoded, string charset)
returns string | byte | ReadableByteChannel | EncodeErrorEncodes a given input with MIME specific Base64 encoding scheme.
Parameters
- contentToBeEncoded string | byte | ReadableByteChannel
-
Content that needs to be encoded can be of type
string
,byte[]
orio:ReadableByteChannel
- charset string - utf-8
-
Charset to be used. This is used only with the string input
-
Return Type
(string | byte | ReadableByteChannel | EncodeError) If the given input is of type string, an encoded
string
is returned. If the given input is of type byte[], an encodedbyte[]
is returned. If the given input is of type io:ReadableByteChannel, an encodedio:ReadableByteChannel
is returned. In case of errors, anEncodeError
record is returned.
Encodes a given byte[] with Base64 encoding scheme.
Parameters
- valueToBeEncoded byte
-
Content that needs to be encoded
-
Return Type
(byte | EncodeError) An encoded byte[]. In case of errors, an
EncodeError
record is returned
Given the Content-Disposition as a string, gets the ContentDisposition object with it.
Parameters
- contentDisposition string
-
Content disposition string
-
Return Type
(ContentDisposition) A
ContentDisposition
object
Given the Content-Type in string, gets the MediaType object populated with it.
Parameters
- contentType string
-
Content-Type in string
-
Return Type
(MediaType | InvalidContentTypeError) MediaType
object or an error in case of invalid content-type
Parameters
- detail string
-
Return Type
(DecodeError)
Parameters
- detail string
-
Return Type
(EncodeError)