Functions
base64Decode | I Decodes a given input with MIME specific Base64 encoding scheme. |
base64DecodeBlob | I Decodes a given byte[] using the Base64 encoding scheme. |
base64Encode | I Encodes a given input with MIME specific Base64 encoding scheme. |
base64EncodeBlob | I Encodes a given byte[] using the Base64 encoding scheme. |
getContentDispositionObject | I Given the Content-Disposition as a string, gets the |
getMediaType | I Gets the |
base64Decode
function base64Decode((string | byte[ ] | ReadableByteChannel) contentToBeDecoded, string charset) returns (string | byte[ ] | ReadableByteChannel | DecodeError)
Decodes 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[]
or io:ReadableByteChannel
- charset string (default "utf-8")
Charset to be used. This is used only with the string input
Return Type
((string | byte[ ] | ReadableByteChannel | DecodeError))A decoded string
if the given input is of type string, a decoded byte[]
if the given input is of
type byte[], a decoded io:ReadableByteChannel
if the given input is of type io:ReadableByteChannel
or else a mime:DecodeError
in case of errors
base64DecodeBlob
function base64DecodeBlob(byte[ ] valueToBeDecoded) returns byte[ ] | DecodeError
Decodes a given byte[] using the Base64 encoding scheme.
Parameters
- valueToBeDecoded byte[ ]
Content, which needs to be decoded
Return Type
(byte[ ] | DecodeError)A decoded byte[]
or else a mime:DecodeError
record in case of errors
base64Encode
function base64Encode((string | byte[ ] | ReadableByteChannel) contentToBeEncoded, string charset) returns (string | byte[ ] | ReadableByteChannel | EncodeError)
Encodes 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[]
or io:ReadableByteChannel
- charset string (default "utf-8")
Charset to be used. This is used only with the string input
Return Type
((string | byte[ ] | ReadableByteChannel | EncodeError))An encoded string
if the given input is of type string, an encoded byte[]
if the given input is of
type byte[], an encoded io:ReadableByteChannel
if the given input is of type io:ReadableByteChannel
,
or else a mime:EncodeError
record in case of errors
base64EncodeBlob
function base64EncodeBlob(byte[ ] valueToBeEncoded) returns byte[ ] | EncodeError
Encodes a given byte[] using the Base64 encoding scheme.
Parameters
- valueToBeEncoded byte[ ]
Content, which needs to be encoded
Return Type
(byte[ ] | EncodeError)An encoded byte[] or else a mime:EncodeError
record in case of errors
getContentDispositionObject
function getContentDispositionObject(string contentDisposition) returns ContentDisposition
Given the Content-Disposition as a string, gets the ContentDisposition
object with it.
1mime:ContentDisposition cDisposition = getContentDispositionObject("form-data; name=filepart; filename=file-01.txt");
Parameters
- contentDisposition string
Content disposition string
getMediaType
function getMediaType(string contentType) returns MediaType | InvalidContentTypeError
Gets the MediaType
object populated with it when the Content-Type
is in string.
1mime:MediaType|mime:InvalidContentTypeError returnVal = getMediaType("custom-header");
Parameters
- contentType string
Content-Type in string
Return Type
(MediaType | InvalidContentTypeError)MediaType
object or else a mime:InvalidContentTypeError
in case of an invalid content-type