base64(3erl)

Hey bestie πŸ’– this is the base64(3erl) page β€” an Erlang Module Definition β€” and it's here to hand you base64 encode and decode, with RFC 2045 as the reference. Short page, big slay. ✨

🌸 NAME 🌸

base64 β€” provides base64 encode and decode, see RFC 2045. That's the name, bestie, and it ate. πŸ’…


πŸ’– DESCRIPTION πŸ’–

Okay so this module provides base64 encode and decode, see RFC 2045.

That's literally the whole description. No secret lore, no side quests. It encodes, it decodes, it references the RFC. Iconic minimalism, periodt. πŸŽ€


🧬 DATA TYPES 🧬

Type check time, bestie! Here's the whole little cast 🫢

  • base64_alphabet() = 65..90 | 97..122 | 48..57 | 43 | 47 | 61 β€” the Base 64 Encoding alphabet, with RFC 4648 as the receipt. It's giving alphabet but make it base64 πŸ’….
  • base64_string() = [base64_alphabet()] β€” Base 64 encoded string. Cute little list of alphabet characters, no cap. πŸŽ€
  • base64_binary() = binary() β€” Base 64 encoded binary. Binary bestie, you know the vibe. πŸ¦‹
  • byte_string() = [byte()] β€” Arbitrary sequences of octets. Octets! Love that for us. 🌸

πŸš€ EXPORTS πŸš€

Function time, and yes every signature is sacred. Let's go πŸ”₯

Decode squad 😭

decode(Base64) -> Data
decode_to_string(Base64) -> DataString
mime_decode(Base64) -> Data
mime_decode_to_string(Base64) -> DataString

Types:

Base64 = base64_string() | base64_binary()
Data = binary()
DataString = byte_string()

This crew decodes a base64-encoded string to plain ASCII. See RFC 4648.

Here's the tea: mime_decode/1 and mime_decode_to_string/1 strip away illegal characters, while decode/1 and decode_to_string/1 only strip away whitespace characters. So the MIME girlies are the ones yeeting illegal chars; the regular decode besties are just handling whitespace. πŸ’…

Encode squad πŸ”₯

encode(Data) -> Base64
encode_to_string(Data) -> Base64String

Types:

Data = byte_string() | binary()
Base64 = base64_binary()
Base64String = base64_string()

This one encodes a plain ASCII string into base64. The result is 33% larger than the data. Yep, 33% bigger β€” that's the base64 tax, bestie. πŸ’Έβœ¨


Big sparkle kisses to Ericsson AB πŸ’– β€” this page is from stdlib 4.3.1.3, manual base64(3erl), and that's a wrap. Bye bestie, go encode something cute! πŸŽ€πŸ‘‘

πŸ“¦ where this page comes from