lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


awesome news!!! just wondering if you would like to share it via gitorious or github, they are much nicer for collaboration!!

Blessings.

On Thu, Apr 1, 2010 at 8:58 PM, Tom N Harris <telliamed@whoopdedo.org> wrote:
http://code.google.com/p/lua-archive/

The Lua Archive library can read and write compressed files in a variety of formats. Modules are provided for direct compression and decompression (zlib, bzip2), reading simply compressed files (gz, bz2), and for working with multi-file archives (tar, zip). Other formats, such as lzma, will be added soon.

Using zlib:
   decompressed = larc.zlib.decompress(compressed)
   z = larc.zlib.compressor{level=9}
   file:write(z(string.rep('a',100)))
   file:write(z(string.rep('b',100)))
   file:write(z()) -- flushes the output

Reading a bz2 file:
   bz2 = larc.bzfile.open("test.bz2")
   print(bz2:read("*line"))

Reading a zip file:
   zip = larc.zipfile.open("test.zip")
   for file in zip:names() do
     if string.match(file, "%.txt$") then
       zip:extract(file)
     end
   end

Lua Archive has a BSD-like license.

--
- tom
telliamed@whoopdedo.org



--
Fernando P. García, http://www.develcuy.com
+51 1 9 8991 7871, Calle Santa Catalina Ancha #377, Cusco - Perú

** Before printing this message, please consider your commitment with the environment, taking care of it depends on you.
** Antes de imprimir este mensaje piensa en tu compromiso con el medio ambiente, protegerlo depende de tí.