All Projects → moteus → ZipWriter

moteus / ZipWriter

Licence: MIT License
Library for creating ZIP archive for Lua

Programming Languages

lua
6591 projects
CMake
9771 projects
shell
77523 projects

Projects that are alternatives of or similar to ZipWriter

zipstream
A command line tool that allows you to easily share files and directories over the network
Stars: ✭ 49 (+226.67%)
Mutual labels:  zip
zipadee
A web app for viewing/editing the contents of a ZIP file
Stars: ✭ 15 (+0%)
Mutual labels:  zip
rc-zip
Pure rust zip & zip64 reading and writing
Stars: ✭ 93 (+520%)
Mutual labels:  zip
HiFramework.Unity
Based on component to manage project's core logic and module used in unity3d
Stars: ✭ 22 (+46.67%)
Mutual labels:  zip
minizip-asm.js
Minizip in javascript. Work with password. Demo:
Stars: ✭ 38 (+153.33%)
Mutual labels:  zip
bled
Base Library for Easy Decompression
Stars: ✭ 21 (+40%)
Mutual labels:  zip
comi
ComiGO:Simple, cross-platform manga reader。简单、跨平台的漫画阅读器。シンプルな漫画リーダー。
Stars: ✭ 34 (+126.67%)
Mutual labels:  zip
python-zipstream
Like Python's ZipFile module, except it works as a generator that provides the file in many small chunks.
Stars: ✭ 117 (+680%)
Mutual labels:  zip
box
Box - Open Standard Archive Format, a zip killer.
Stars: ✭ 38 (+153.33%)
Mutual labels:  zip
ratarmount
Random Access Read-Only Tar Mount
Stars: ✭ 217 (+1346.67%)
Mutual labels:  zip
AnonCracker
A single tool to bruteforce pdf , zip and hashes very super fast tool developed with python3
Stars: ✭ 36 (+140%)
Mutual labels:  zip
uncompress-react-native
Simple library to decompress files .zip, .rar, .cbz, .cbr in React Native.
Stars: ✭ 36 (+140%)
Mutual labels:  zip
laravel-backup-shield
🔒Password protection (and encryption) for your laravel backups.
Stars: ✭ 32 (+113.33%)
Mutual labels:  zip
unzip
Tiny unzip helper class for .NET 3.5 Client Profile and Mono 2.10, written in pure C#.
Stars: ✭ 25 (+66.67%)
Mutual labels:  zip
ToGoZip
Android share/sendTo menu implementation "add2Zip"
Stars: ✭ 44 (+193.33%)
Mutual labels:  zip
terraform-external-module-artifact
Terraform module to fetch any kind of artifacts using curl (binary and text okay)
Stars: ✭ 13 (-13.33%)
Mutual labels:  zip
lrkFM
Awesome, (ad) free, open source file manager for Android
Stars: ✭ 44 (+193.33%)
Mutual labels:  zip
zip
PHP ZipArchive toolbox
Stars: ✭ 30 (+100%)
Mutual labels:  zip
aspZip
A classic ASP zip and unzip utility class that uses the native zip support from Windows (XP and above) - no components needed
Stars: ✭ 24 (+60%)
Mutual labels:  zip
zip-bucket
zips files in a Google Cloud Storage [tm] bucket
Stars: ✭ 32 (+113.33%)
Mutual labels:  zip

Library for creating ZIP archive for Lua 5.1/5.2/5.3

Based on http://wiki.tcl.tk/15158

Build Status Coverage Status Licence

Documentation

Documentation

Dependencies

Core

Optional

Test

Supports

  • write to non seekable stream
  • utf8 file names in archives (required iconv)
  • ZIP64 (does not use stream:seek())

Install

Since version 0.1.5 rockspec does not have any dependencies because there no way to specify them as optional. E.g. if you already have installed lua-zlib and you then install lzlib then your existed code may stop working. So you have to install appropriate library by hand. Also some dependencies need only for specific Lua version.

  • Install zlib binding
luarocks install lua-zlib

or

luarocks install lzlib
  • Lua 5.1/5.2/JIT dependencies
luarocks install struct
  • Lua 5.1 dependencies
luarocks install bit32
  • Install ZipWriter itself
luarocks install zipwriter

Usage

Make simple archive

local ZipWriter = require "ZipWriter"

function make_reader(fname)
  local f = assert(io.open(fname, 'rb'))
  local chunk_size = 1024
  local desc = { -- `-rw-r-----` on Unix
    istext   = true,
    isfile   = true,
    isdir    = false,
    mtime    = 1348048902, -- lfs.attributes('modification')
    platform = 'unix',
    exattrib = {
      ZipWriter.NIX_FILE_ATTR.IFREG,
      ZipWriter.NIX_FILE_ATTR.IRUSR,
      ZipWriter.NIX_FILE_ATTR.IWUSR,
      ZipWriter.NIX_FILE_ATTR.IRGRP,
      ZipWriter.DOS_FILE_ATTR.ARCH,
    },
  }
  return desc, desc.isfile and function()
    local chunk = f:read(chunk_size)
    if chunk then return chunk end
    f:close()
  end
end

ZipStream = ZipWriter.new()
ZipStream:open_stream( assert(io.open('readme.zip', 'w+b')), true )
ZipStream:write('README.md', make_reader('README.md'))
ZipStream:close()

Reading file from FTP and saving archive on FTP

local ZipWriter = require "ZipWriter"
local FTP = require "socket.ftp"

local ZipStream = ZipWriter.new()

-- write zip file directly to ftp
-- lua 5.1 needs coco
ZipStream:open_writer(ZipWriter.co_writer(function(reader)
  FTP.put{
    -- ftp params ...
    path = 'test.zip';
    src  = reader;
  }
end))

-- read from FTP
FTP.get{
  -- ftp params ...
  path = 'test.txt'
  sink = ZipWriter.sink(ZipStream, 'test.txt', {isfile=true;istext=1})
}

ZipStream:close()

Make encrypted archive

local ZipWriter  = require"ZipWriter"
local AesEncrypt = require"ZipWriter.encrypt.aes"

ZipStream = ZipWriter.new{
  encrypt = AesEncrypt.new('password')
}

-- as before
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].