Bodge.app

global base64.url

Base64url Encoding & Decoding

@see base64 for a standard base64 variant


methods


M.encode


function M.encode(
  data: string,
  pad: boolean
) ->  (string,integer)

@param data - The binary data string to be encoded.

@param pad - Determines if padding chaaracters be added. [Default: false]

Encode raw data as a base64url string.

M.decode


function M.decode(
  data: string,
  len
) ->  string

@param data - The base64url encoded string to be decoded.

Decode a base64url string to raw data.

Note: this variant will handle both base64 and base64url. If you're not sure which variant your data is encoded with, use this one.