discord test stars

About

Base64 encoding and decoding in the Mys programming language.

Project: https://github.com/mys-lang/package-base64

Example

The code:

from base64 import encode
from base64 import decode
from base64 import encode_bytes
from base64 import decode_bytes

func main():
    print("Encoded:      ", encode(b"foo"))
    print("Decoded:      ", decode("Zm9v"))
    print("Encoded bytes:", encode_bytes(b"foo"))
    print("Decoded bytes:", decode_bytes(b"Zm9v"))

Build and run:

 mys run
 Reading package configuration (0 seconds)
 Building (0.58 seconds)
Encoded:       Zm9v
Decoded:       b"foo"
Encoded bytes: b"Zm9v"
Decoded bytes: b"foo"

API

class Base64Error(Error):
    message: string
func encode(data: bytes) -> string:
    Encode given data.
func decode(data: string) -> bytes:
    Decode given base64 encoded data.
func encode_bytes(data: bytes) -> bytes:
    Encode given data.
func decode_bytes(data: bytes) -> bytes:
    Decode given base64 encoded data.