mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-11-08 06:18:21 +01:00
e5a090b01c
Adjusted socket.try.
13 lines
377 B
Lua
13 lines
377 B
Lua
local source = ltn12.source.file(io.stdin)
|
|
local sink = ltn12.sink.file(io.stdout)
|
|
local convert
|
|
if arg and arg[1] == '-d' then
|
|
convert = mime.decode("base64")
|
|
else
|
|
local base64 = mime.encode("base64")
|
|
local wrap = mime.wrap()
|
|
convert = ltn12.filter.chain(base64, wrap)
|
|
end
|
|
source = ltn12.source.chain(source, convert)
|
|
repeat until not ltn12.pump(source, sink)
|