Giter VIP home page Giter VIP logo

aslzip's Introduction

aslzip

An easy to use Zip file compress/uncompress library for ASL. It is based on the miniz library. It might be merged into the ASL library in the future. Zip archives and inserted files can have Unicode names in UTF-8, even on Windows.

You can read a specific contained file as a string or as a binary blob. Or you can extract it to a given directory (asl namespace omitted here):

ZipFile zip("archive.zip");

String text = zip["some/file.txt"].text();

zip["some/data.csv"].extract("./");  // will produce "./data.csv"

Adding files to a new zip archive can also use files, strings or byte arrays as input:

ZipFile zip("archive.zip");

zip.add("package.json", Json::encode(info));

zip.add("images/", File("some/logo.png"));  // the zip entry will be "images/logo.png"

And you can pack or unpack directories recursively with all their content:

ZipFile("archive.zip").unpack("data/desdir");

ZipFile("archive2.zip").pack("some/dir", true);

The second case will pack the contents of directory "some/dir" into "archive2.zip". The optional true argument makes the directory name "dir" be placed at the root of the zip file.

You can also enumerate the contents of a zip archive:

for(auto& item : zip.items())
{
	printf("%s %i %s\n", *item.name(), item.size(), *item.lastModified().toString());
	
	// item.text() extracts the text content
	// item.content() extracts the binary content
}

aslzip's People

Contributors

aslze avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.