]> gitweb.factorcode.org Git - factor.git/blob - basis/base64/base64-docs.factor
scryfall: better moxfield words
[factor.git] / basis / base64 / base64-docs.factor
1 USING: help.markup help.syntax 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-lines base64> } ;
11
12 HELP: >base64-lines
13 { $values { "seq" sequence } { "base64" "a string of base64 characters" } }
14 { $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. A crlf is inserted for every 76 characters of output." }
15 { $see-also >base64 base64> } ;
16
17
18 HELP: base64>
19 { $values { "base64" "a string of base64 characters" } { "seq" sequence } }
20 { $description "Converts a string in base64 encoding back into its binary representation." }
21 { $examples
22     { $example "USING: prettyprint base64 strings ;" "\"VGhlIG1vbm9yYWlsIGlzIGEgZnJlZSBzZXJ2aWNlLg==\" base64> >string ." "\"The monorail is a free service.\"" }
23 }
24 { $notes "This word will throw if the input string contains characters other than those allowed in base64 encodings." }
25 { $see-also >base64 >base64-lines } ;
26
27 HELP: encode-base64
28 { $description "Reads the standard input and writes it to standard output encoded in base64." } ;
29
30 HELP: decode-base64
31 { $description "Reads the standard input and decodes it, writing to standard output." } ;
32
33 HELP: encode-base64-lines
34 { $description "Reads the standard input and writes it to standard output encoded in base64 with a crlf every 76 characters." } ;
35
36 ARTICLE: "base64" "Base 64 conversions"
37 "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
38 "Converting to and from base64 as strings:"
39 { $subsections
40     >base64
41     >base64-lines
42     base64>
43 }
44 "Using base64 from streams:"
45 { $subsections
46     encode-base64
47     encode-base64-lines
48     decode-base64
49 } ;
50
51 ABOUT: "base64"