Codec.Binary.Uu
Description
Uuencoding is notoriously badly specified. This implementation is compatible with the GNU Sharutils (http://www.gnu.org/software/sharutils/).
Further documentation and information can be found at http://www.haskell.org/haskellwiki/Library/Data_encoding.
Documentation
encode :: [Word8] -> String
Encode data.
decode :: String -> Maybe [Word8]
Decode data (strict).
decode' :: String -> [Maybe Word8]
Decode data (lazy).
Arguments
:: Int | length (value should be in the range |
-> String | |
-> [String] |
Chop up a string in parts. Each string in the resulting list is prepended with the length according to the uuencode "specificiation".
Notes:
- The length of the strings in the result will be
(n -1)
. Thediv
4 * 4 + 1-1
comes from the need to prepend the length (which explains the final+1
). Keeping it to a multiple of 4 means that strings returned fromencode
can be chopped without requiring any changes. - The length of lines in GNU's sharutils is 61.
unchop :: [String] -> String
Concatenate the strings into one long string. Each string is assumed to be prepended with the length according to the uuencode specification.