Functions

base64Decode
I

Deprecated API.

base64DecodeBlob
I

Deprecated API.

base64Encode
I

Deprecated API.

base64EncodeBlob
I

Deprecated API.

getContentDispositionObject
I

Given the Content-Disposition as a string, gets the ContentDisposition object with it.

getMediaType
I

Gets the MediaType object populated with it when the Content-Type is in string.

base64Decode

function base64Decode((string | byte[ ] | ReadableByteChannel) contentToBeDecoded, string charset) returns (string | byte[ ] | ReadableByteChannel | DecodeError)
Isolated Function

Deprecated API. 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
Isolated Function

Deprecated API. 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)
Isolated Function

Deprecated API. 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
Isolated Function

Deprecated API. 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
Isolated Function

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

Return Type

(ContentDisposition)

A ContentDisposition object

getMediaType

function getMediaType(string contentType) returns MediaType | InvalidContentTypeError
Isolated Function

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