New filter scheme.
ltn12 and mime updated. smtp/ftp broken.
This commit is contained in:
parent
b6edaac284
commit
bcc0c2a9f0
17 changed files with 568 additions and 530 deletions
17
etc/b64.lua
17
etc/b64.lua
|
@ -1,13 +1,12 @@
|
|||
local source = ltn12.source.file(io.stdin)
|
||||
local sink = ltn12.sink.file(io.stdout)
|
||||
local convert
|
||||
if arg and arg[1] == '-d' then
|
||||
convert = socket.mime.decode("base64")
|
||||
convert = mime.decode("base64")
|
||||
else
|
||||
local base64 = socket.mime.encode("base64")
|
||||
local wrap = socket.mime.wrap()
|
||||
convert = socket.mime.chain(base64, wrap)
|
||||
end
|
||||
while 1 do
|
||||
local chunk = io.read(4096)
|
||||
io.write(convert(chunk))
|
||||
if not chunk then break end
|
||||
local base64 = mime.encode("base64")
|
||||
local wrap = mime.wrap()
|
||||
convert = ltn12.filter.chain(base64, wrap)
|
||||
end
|
||||
source = ltn12.source.chain(source, convert)
|
||||
ltn12.pump(source, sink)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue