Independent Base64 for UTF-8 strings and bytes; discontinued in favor of moonbitlang/core/encoding/base64
import {
"moonbitlang/core/encoding/base64",
"moonbitlang/core/encoding/utf8",
} for "test"test "official Base64 with Unicode" {
let text = "你好🌙"
let encoded = @base64.encode(@utf8.encode(text))
assert_eq(encoded, "5L2g5aW98J+MmQ==")
assert_eq(@utf8.decode(@base64.decode(encoded)), text)
}moon add PerfectPan/base64import {
"PerfectPan/base64",
} for "test"test "text and bytes" {
assert_eq(@base64.base64_encode("你好🌙"), "5L2g5aW98J+MmQ==")
assert_eq(@base64.base64_decode("5L2g5aW98J+MmQ=="), Ok("你好🌙"))
assert_eq(@base64.base64_decode("Zg"), Ok("f"))
assert_eq(@base64.base64_encode_bytes(b"\x00\xFF\x80"), "AP+A")
assert_eq(@base64.base64_decode_bytes("AP+A"), Ok(b"\x00\xFF\x80"))
assert_eq(@base64.base64_decode("AP+A"), Err("invalid UTF-8 input"))
}| Function | Input | Output |
|---|---|---|
| base64_encode | String | String |
| base64_decode | String | Result[String, String] |
| base64_encode_bytes | BytesView | String |
| base64_decode_bytes | String | Result[Bytes, String] |
moon version --all
moon fmt
moon check --deny-warn --target wasm,wasm-gc,js,native
moon test --deny-warn --target wasm,wasm-gc,js,native
moon info --target wasm,wasm-gc,js,native
moon fmt --check
python3 -m unittest discover -s scripts -p 'test_*.py'moon package --list
moon package
python3 scripts/check_publish.pyThe preflight runs moon publish --dry-run. With moon 0.1.20260920 and
mooncake-bin 0.1.20260911, the publisher treats the registry's successful
202 Accepted dry-run response as a failure and exits 255. The preflight
accepts this specific response only when it confirms that no changes were
made and names the current module and version. Other errors remain failures;
a native successful exit is passed through. This is a local compatibility
fix and does not change the installed toolchain or publish a version.moon publish
moon view PerfectPan/base64 --versionsfn base64_decode(input : String) -> Result[String, String]fn base64_decode_bytes(input : String) -> Result[Bytes, String]fn base64_encode(input : String) -> Stringfn base64_encode_bytes(input : BytesView) -> StringInstall
Download zipIndependent Base64 for UTF-8 strings and bytes; discontinued in favor of moonbitlang/core/encoding/base64