Safe Haskell | None |
---|---|
Language | Haskell2010 |
Lazy
ByteString
base64 encoding with URL and filename safe alphabet.
Synopsis
- data ByteString64
- makeByteString64 :: ByteString -> ByteString64
- getByteString64 :: ByteString64 -> ByteString
- mkBS64 :: ByteString -> ByteString64
- getBS64 :: ByteString64 -> ByteString
- getEncodedByteString64 :: ByteString64 -> ByteString
Documentation
data ByteString64 Source #
Aeson serialisable bytestring. Uses base64 encoding.
The inner
ByteString
is in raw format.
>>>
let bs64 = makeByteString64 "foobar"
>>>
bs64
mkBS64 "foobar"
Binary
instance doesn't use base64 encoding:
>>>
Binary.encode bs64
"\NUL\NUL\NUL\NUL\NUL\NUL\NUL\ACKfoobar"
Aeson
instance does:
>>>
Aeson.encode bs64
"\"Zm9vYmFy\""
This module uses standard alphabet
>>>
Aeson.encode (makeByteString64 "aa\191")
"\"YWG_\""
Instances
makeByteString64 :: ByteString -> ByteString64 Source #
Wrap
ByteString
into
ByteString64
. Essentially
coerce
.
getByteString64 :: ByteString64 -> ByteString Source #
Unwrap
ByteString
from
ByteString64
. Essentially
coerce
.
mkBS64 :: ByteString -> ByteString64 Source #
Shorter variant of
makeByteString64
getBS64 :: ByteString64 -> ByteString Source #
getEncodedByteString64 :: ByteString64 -> ByteString Source #
Get base64 encode bytestring
>>>
getEncodedByteString64 "foobar"
"Zm9vYmFy"
>>>
getEncodedByteString64 "aa\191"
"YWG_"