diff options
Diffstat (limited to 'etc/b64.lua')
-rw-r--r-- | etc/b64.lua | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/etc/b64.lua b/etc/b64.lua index 7a4607d..de83578 100644 --- a/etc/b64.lua +++ b/etc/b64.lua | |||
@@ -1,6 +1,11 @@ | |||
1 | local base64 = socket.mime.base64.encode() | 1 | local convert |
2 | local split = socket.mime.split() | 2 | if arg and arg[1] == '-d' then |
3 | local convert = socket.mime.chain(base64, split) | 3 | convert = socket.mime.decode("base64") |
4 | else | ||
5 | local base64 = socket.mime.encode("base64") | ||
6 | local wrap = socket.mime.wrap() | ||
7 | convert = socket.mime.chain(base64, wrap) | ||
8 | end | ||
4 | while 1 do | 9 | while 1 do |
5 | local chunk = io.read(4096) | 10 | local chunk = io.read(4096) |
6 | io.write(convert(chunk)) | 11 | io.write(convert(chunk)) |