Using uuencoding

Verified
Added by iNTERFACEWARE

Encode and decode uuencoded strings or streams , using filter.uuencoding.enc() and filter.uuencoding.dec()

Source Code
-- uuencode a string

-- encode a string
local enc = filter.uuencoding.enc('Hello World', 'test.txt')
trace(enc)

-- decode the encoded string
local dec = filter.uuencoding.dec(enc)
trace(dec)

-- uuencode a stream

-- create a sample text file in the Iguana install directory
local f = io.open('test.txt', 'w')
f:write('Hello World')
f:close()

-- encode a stream
local inp = stream.fromFile('test.txt')
local out = filter.uuencoding.enc(inp, 'test.txt')

-- save the stream to a file
stream.toFile('test-uuencode.txt', out)

-- decode the saved uuencode stream
local inp = stream.fromFile('test-uuencode.txt')
local out = filter.uuencoding.dec(inp, 'test.txt')
trace(stream.toString(out))
Description
Encode and decode uuencoded strings or streams , using filter.uuencoding.enc() and filter.uuencoding.dec()
Usage Details

Demonstrates how to encode and decode uuencode strings from a strings or streams, by using filter.uuencoding.enc{} and filter.uuencoding.dec{}.

How to use the snippet:

  • Load the stream module into your project
  • Paste the code into your script
  • Inspect the annotations to see how it works