add optional newline argument to `base64-encode'
original commit: a12f9831a3
This commit is contained in:
parent
e6d06d9bd5
commit
dbe90fa15e
|
@ -8,11 +8,12 @@ utilities for Base 64 (MIME-standard) encoding and decoding.}
|
||||||
|
|
||||||
@section[#:tag "base64-procs"]{Functions}
|
@section[#:tag "base64-procs"]{Functions}
|
||||||
|
|
||||||
@defproc[(base64-encode [bstr bytes?]) bytes?]{
|
@defproc[(base64-encode [bstr bytes?] [newline-bstr bytes? #"\r\n"]) bytes?]{
|
||||||
|
|
||||||
Consumes a byte string and returns its Base 64 encoding as a new byte
|
Consumes a byte string and returns its Base 64 encoding as a new byte
|
||||||
string. The returned string is broken into 72-byte lines separated by
|
string. The returned string is broken into 72-byte lines separated by
|
||||||
CRLF combinations, and always ends with a CRLF combination unless the
|
@racket[newline-bstr], which defaults to a CRLF combination, and the
|
||||||
|
result always ends with a @racket[newline-bstr] unless the
|
||||||
input is empty.}
|
input is empty.}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,4 +12,11 @@
|
||||||
net/qp
|
net/qp
|
||||||
mzlib/port)
|
mzlib/port)
|
||||||
|
|
||||||
|
(test #"" base64-encode #"")
|
||||||
|
(test #"" base64-encode #"" #"<>")
|
||||||
|
(test #"V2h5IGRvIGF4ZSBtdXJkZXJlcnMgb25seSBhdHRhY2sKV2hlbiB5b3UncmUgcGFydGlhbGx5\r\nIG51ZGUKT3IgeW91J3JlIHRha2luZyBhIGJhdGg=\r\n"
|
||||||
|
base64-encode #"Why do axe murderers only attack\nWhen you're partially nude\nOr you're taking a bath")
|
||||||
|
(test #"V2h5IGRvIGF4ZSBtdXJkZXJlcnMgb25seSBhdHRhY2sKV2hlbiB5b3UncmUgcGFydGlhbGx5<>IG51ZGUKT3IgeW91J3JlIHRha2luZyBhIGJhdGg=<>"
|
||||||
|
base64-encode #"Why do axe murderers only attack\nWhen you're partially nude\nOr you're taking a bath" #"<>")
|
||||||
|
|
||||||
(report-errs)
|
(report-errs)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user