ivadzy/bbase64/1.0.0

NOTE: the latest version is 1.1.1

Renamed to chelovek0v/bbase64. It is published under that name, and new versions come out there.

Versions published as ivadzy/bbase64 still install under that name. 4 versions of 4 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/chelovek0v/bbase64.

What we checked: The repo moved to github.com/chelovek0v/bbase64. Rebuilt with git archive from commit 0cb375868dc3 of https://github.com/chelovek0v/bbase64 (zip prefix ivadzy-bbase64-0cb3758/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 6dc76aacf91154590088b97637eb993cf1ec9c9c.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/ivadzy/bbase64/zipball/1.0.0/

Base64

This package helps you work with Base64 encoding, providing a similar interface as in elm/bytes and elm/json

Why another Base64 library?

  • Supports Elm 0.19
  • Insensitive to padding (as atob/btoa in JS)
  • Functional implementation
  • Supports raw bytes encoding/decoding
  • There is elm/bytes under the hood, so less errors will occur during validations
  • Interface is consistent with an Elm's encoders/decoders interface

Usage

The package lets you create encoders and decoders to work with strings and bytes.

Converting a string into a Base64 string:

import Bytes.Encode
import Base64.Encode as Encode


input =
    "Example input string"

encoded =
    Encode.encode (Encode.string input)

Encoding a bytes seqeunce:

import Bytes.Encode
import Base64.Decode as Decode
import Base64.Encode as Encode

stringAsBytes = 
    Bytes.Encode.encode (Bytes.Encode.string "H💩la!")

encoded =
    Encode.encode (Encode.bytes stringAsBytes)

decoded =
    Decode.decode Decode.string encoded

Or you can decode string into raw bytes with Base64.Decode.bytes:

import Base64.Decode as Decode
import Bytes
import Bytes.Decode

-- decodedAsBytes = Decode.decode Decode.bytes someInput
decodedAsString =
    Bytes.Decode.decode (Bytes.Decode.string (Bytes.width decodedAsBytes)) decodedAsBytes