Functions - mime

base64Decode

Deprecated API. Decodes a given input with MIME specific Base64 encoding scheme.

base64DecodeBlob

Deprecated API. Decodes a given byte[] with Base64 encoding scheme.

base64Encode

Deprecated API. Encodes a given input with MIME specific Base64 encoding scheme.

base64EncodeBlob

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

Constructs a DecodeError with the given details.

prepareEncodingErrorWithDetail

Constructs an EncodeError with the given details.

base64Decode

(string | byte | ReadableByteChannel contentToBeDecoded, string charset)

returns string | byte | ReadableByteChannel | DecodeError

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 - 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 decoded byte[] is returned. If the given input is of type io:ReadableByteChannel, a decoded io:ReadableByteChannel is returned. In case of errors, an DecodeError record is returned.

base64DecodeBlob

(byte valueToBeDecoded)

returns byte | DecodeError

Deprecated API. 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, an DecodeError record is returned

base64Encode

(string | byte | ReadableByteChannel contentToBeEncoded, string charset)

returns string | byte | ReadableByteChannel | EncodeError

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 - 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 encoded byte[] is returned. If the given input is of type io:ReadableByteChannel, an encoded io:ReadableByteChannel is returned. In case of errors, an EncodeError record is returned.

base64EncodeBlob

(byte valueToBeEncoded)

returns byte | EncodeError

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

getContentDispositionObject

(string contentDisposition)

returns ContentDisposition

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

Parameters

  • contentDisposition string
  • Content disposition string

getMediaType

(string contentType)

returns MediaType | InvalidContentTypeError

Given the Content-Type in string, gets the MediaType object populated with it.

Parameters

  • contentType string
  • Content-Type in string

prepareDecodingErrorWithDetail

(string detail)

returns DecodeError

Constructs a DecodeError with the given details.

Parameters

  • detail string
  • error details

  • Return Type

    (DecodeError)
  • DecodeError with the given details set to message

prepareEncodingErrorWithDetail

(string detail)

returns EncodeError

Constructs an EncodeError with the given details.

Parameters

  • detail string
  • error details

  • Return Type

    (EncodeError)
  • EncodeError with the given details set to message