]> gitweb.factorcode.org Git - factor.git/blob - basis/base64/base64-docs.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / basis / base64 / base64-docs.factor
1 USING: help.markup help.syntax kernel math sequences ;
2 IN: base64
3
4 HELP: >base64
5 { $values { "seq" sequence } { "base64" "a string of base64 characters" } }
6 { $description "Converts a sequence to its base64 representation by taking six bits at a time as an index into a lookup table containing alphanumerics, '+', and '/'.  The result is padded with '=' if the input was not a multiple of six bits." }
7 { $examples
8     { $example "USING: prettyprint base64 strings ;" "\"The monorail is a free service.\" >base64 >string ." "\"VGhlIG1vbm9yYWlsIGlzIGEgZnJlZSBzZXJ2aWNlLg==\"" }
9 }
10 { $see-also base64> } ;
11
12 HELP: base64>
13 { $values { "base64" "a string of base64 characters" } { "seq" sequence } }
14 { $description "Converts a string in base64 encoding back into its binary representation." }
15 { $examples
16     { $example "USING: prettyprint base64 strings ;" "\"VGhlIG1vbm9yYWlsIGlzIGEgZnJlZSBzZXJ2aWNlLg==\" base64> >string ." "\"The monorail is a free service.\"" }
17 }
18 { $notes "This word will throw if the input string contains characters other than those allowed in base64 encodings." }
19 { $see-also >base64 } ;
20
21 ARTICLE: "base64" "Base 64 conversions"
22 "The " { $vocab-link "base64" } " vocabulary implements conversions of sequences to printable characters in base 64. These plain-text representations of binary data may be passed around and converted back to binary data later." $nl
23 "Converting to base 64:"
24 { $subsection >base64 }
25 "Converting back to binary:"
26 { $subsection base64> } ;
27
28 ABOUT: "base64"