Net: PLT Networking Libraries

1`` | URLs and HTTP
2`` | URI Codec: Encoding and Decoding URIs
3`` | FTP: Client Downloading
4`` | Send URL: Opening a Web Browser
5`` | SMTP: Sending E-Mail
6`` | sendmail: Sending E-Mail
7`` | Headers: Parsing and Constructing
8`` | IMAP: Reading Mail
9`` | POP3: Reading Mail
10`` | MIME: Decoding Internet Data
11`` | Base 64: Encoding and Decoding
12`` | Quoted-Printable: Encoding and Decoding
13`` | DNS: Domain Name Service Queries
14`` | NNTP: Newsgroup Protocol
15`` | TCP: Unit and Signature
16`` | TCP Redirect: tcp^ via Channels
17`` | SSL Unit: tcp^ via SSL
18`` | CGI Scripts
19`` | Cookie: HTTP Client Storage
| Bibliography
| Index

On this page:

11.1`` Functions
base64-encode
base64-decode
base64-encode-stream
base64-decode-stream
11.2`` Base64 Unit
base64@
11.3`` Base64 Signature
base64^

Version: 4.0.2
contents index
← prev up next →

### 11`` Base 64: Encoding and Decoding

(require net/base64)

The net/base64 library provides utilities for Base 64 (mime-standard) encoding and decoding.

#### 11.1`` Functions

(base64-encode bstr) → bytes?
bstr : bytes?

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 CRLF combinations, and always ends with a CRLF combination unless the input is empty.

(base64-decode bstr) → bytes?
bstr : bytes?

Consumes a byte string and returns its Base 64 decoding as a new byte string.

(base64-encode-stream in out [newline-bstr]) → void?
in : input-port?
out : output-port?
newline-bstr : bytes? = #"\n"

Reads bytes from in and writes the encoded result to out, breaking the output into 72-character lines separated by newline-bstr, and ending with newline-bstr unless the input stream is empty. Note that the default newline-bstr is just #"\n", not #"\r\n". The procedure returns when it encounters an end-of-file from in.

(base64-decode-stream in out) → void?
in : input-port?
out : output-port?

Reads a Base 64 encoding from in and writes the decoded result to out. The procedure returns when it encounters an end-of-file or Base 64 terminator = from in.

#### 11.2`` Base64 Unit

(require net/base64-unit)

base64@ : unit?

Imports nothing, exports base64^.

#### 11.3`` Base64 Signature

(require net/base64-sig)

base64^ : signature

Includes everything exported by the net/base64 module.

contents index
← prev up next →