Top Documents Download Gallery Repository
Are you looking for a Software Engineer? Check Here

7base64 Module

The base64 module provides measures to decode/encode data formatted in base64 format.

To decode a stream that is formatted in base64, use one of the following functions:

To encode a data into base64 format, use one of the following functions:

7.1Module Function

base64.decode
base64.decode(stream:stream:r) {block?}
Reads text stream that is formatted in base64 and returns the decoded result in binary.

If block is specified, it would be evaluated with a block parameter |data:binary|, where data is the created instance. In this case, the block's result would become the function's returned value.

base64.encode
base64.encode(stream:stream:r, linelen:number:nil => 76) {block?}
Encodes content of the stream into base64 format and returns the result in binary.

If block is specified, it would be evaluated with a block parameter |data:binary|, where data is the created instance. In this case, the block's result would become the function's returned value.

base64.reader
base64.reader(stream:stream:r) {block?}
Creates a stream instance that reads data formatted in base64 from stream.

If block is specified, it would be evaluated with a block parameter |s:stream|, where s is the created instance. In this case, the block's result would become the function's returned value.

base64.writer
base64.writer(stream:stream:w, linelen:number:nil => 76) {block?}
Creates a stream instance that encodes data to base64 format and writes it to the stream.

The number of characters per line is specified by an argument linelen. If omitted, that is 76.

If block is specified, it would be evaluated with a block parameter |s:stream|, where s is the created instance. In this case, the block's result would become the function's returned value.

7.2Extension to stream Class

This module extends the stream class with methods described here.

stream#reader@base64
stream#reader@base64() {block?}
Creates a stream instance that reads data formatted in base64 from the target stream instance.

If block is specified, it would be evaluated with a block parameter |s:stream|, where s is the created instance. In this case, the block's result would become the function's returned value.

stream#writer@base64
stream#writer@base64(linelen:number:nil => 76) {block?}
Creates a stream instance that encodes data to base64 format and writes it to the target stream instance.

The number of characters per line is specified by an argument linelen. If omitted, that is 76.

If block is specified, it would be evaluated with a block parameter |s:stream|, where s is the created instance. In this case, the block's result would become the function's returned value.


Copyright (C) 2011-2017 ypsitau