Base64

Utility library for encoding and decoding base64 data.


Source: pkg/lua/lib/base64.go | Import: base64

Functions


encode

encode(data, url?, raw?) -> string

Arguments

  • data string
  • url bool - If true, use URL encoding.
  • raw bool - If true, use raw encoding.
Return Values

  • string - The base64 encoded data.
decode

decode(data, url?, raw?) -> string

Arguments

  • data string
  • url bool - If true, use URL encoding.
  • raw bool - If true, use raw encoding.
Return Values

  • string - The base64 decoded data.
encode_image

encode_image(id, raw?) -> string

@blocking
Arguments

  • id int<collection.IMAGE> - The image to encode.
  • raw bool - If true, use raw encoding.
Return Values

  • string - The base64 encoded data.
encode_image_to_file

encode_image_to_file(id, path, raw?)

Arguments

  • id int<collection.IMAGE> - The image to encode.
  • path string - The path to save the image.
  • raw bool - If true, use raw encoding.
decode_image

decode_image(data, name, encoding, model?, raw?) -> int<collection.IMAGE>

Arguments

  • data string - The base64 encoded image data.
  • name string - The name of the image.
  • encoding int<image.ENCODING> - The image encoding must match the encoding of the data.
  • model int<image.MODEL> - Used only to specify default when there is an unsupported color model.
  • raw bool - If true, use raw encoding.
Return Values

  • int<collection.IMAGE> - The decoded image.
decode_image_from_file

decode_image_from_file(path, name, encoding, model?, raw?) -> int<collection.IMAGE>

Arguments

  • path string - The path to the base64 encoded image data.
  • name string - The name of the image.
  • encoding int<image.ENCODING> - The image encoding must match the encoding of the data.
  • model int<image.MODEL> - Used only to specify default when there is an unsupported color model.
  • raw bool - If true, use raw encoding.
Return Values

  • int<collection.IMAGE> - The decoded image.