[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: LAR, LuaZip, LuaTar (was: Lua as a data description language)
- From: "Danilo Tuler" <tuler@...>
- Date: Fri, 4 Jun 2004 19:37:44 -0300
Hi,
> >- Compress your (compiled) data files with gzip or bzip2.
> >- Write a chunkreader that autodetects a compressed file and uncompresses
> > on-the-fly. The zlib/libbz2 manuals should have an example that does
> > exactly that.
> >- Hook the chunkreader into your own dofile().
>
> I wrote a library that can read Lua code from different
> sources (file, memory), passing it through uncompressing
> filters (bunzip2, gunzip).
I don't like to announce something and not releasing a public version, but
as the subject is being discussed, this might be interesting.
We, the Kepler Team, are developing three libraries, LAR, LuaZip and LuaTar.
A preview version will be available next week.
-----------------------------------------------------------------------
LAR (Lua ARchives) is a virtual file system using ZIP or tar.gz compression.
The idea is similar to a jar (Java Archive), war (Web archive), etc.
The library basically improves the require function to virtualize files in
an archive.
You can zip (or tar.gz) a bunch of lua files in a .lar file and require them
as usual, transparently.
This library uses LuaZip and LuaTar to read the contents from the archives.
-----------------------------------------------------------------------
LuaZip is a library to read files inside zip files.
The usage is very intuitive. Example below:
local zf, err = zip.open('test.zip')
for f in zf:files() do
print(f.filename)
end
local f = zf:open('foo.txt')
print(f:read('*a'))
f:close()
zf:close()
-----------------------------------------------------------------------
LuaTar is a library to read files inside tar files.
The usage is as intuitive as LuaZip. Example below.
Notice that LuaTar uses lzlib by Thiago Dionisio.
local gf = gzip.open("lzlib.tar.gz", "rb")
local tf = tar.open(gf)
local f = tf:open("lzlib/README")
print(f:read("*a"))
f:close()
tf:close()
gf:close()
-----------------------------------------------------------------------
Comments are welcome.
-- Danilo