Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Access files inside tar- and zipballs
C Lua
tree: efe22390fe

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
src
tests
.gitignore
Makefile
README.md
init.lua
license.txt
package.lua

README.md

Balls

Collection of helpers to deal with compressed data

Usage

local Zlib = require('balls').Zlib

local file = require('fs').createReadStream(__dirname .. '/test.gz', {
  chunk_size = 1,
})

local gunzip = Zlib.inflator()
gunzip:on('data', function (text)
  print('CHUNK', text)
end)
gunzip:on('end', function ()
  print('GUNZIPPED')
end)
file:pipe(gunzip)

local Zip = require('balls').Zip
local uzip = Zip:new(
    require('fs').createReadStream(__dirname .. '/test.zip'),
    {
      -- TODO: auto guess
      inflateOptions = -15
    }
  )
  -- zip entry parsed
  :on('entry', function (entry)
    p('E', entry.name, entry.comp_size)
  end)
  -- zipball read entirely
  :on('end', function ()
    print('UNZIPPED')
  end)

License

MIT

Something went wrong with that request. Please try again.