Giter Club home page Giter Club logo

minizip-asm.js's Introduction

minizip-asm.js

Build Status npm version

Minizip in javascript. Work with password. Demo: https://rf00.github.io/minizip-asm.js/example/

Features

  • Zip file
  • Extract file
  • Work with password

Installation

<script src="https://raw.githubusercontent.com/rf00/minizip-asm.js/master/lib/minizip-asm.min.js"></script>
npm install minizip-asm.js

var Minizip = require('minizip-asm.js');

Getting started

var fs = require("fs");

var text = new Buffer("Abc~~~");
var mz = new Minizip();

mz.append("haha/abc.txt", text, {password: "~~~"});
fs.writeFileSync("abc.zip", new Buffer(mz.zip()));

Usage

new Minizip(ArrayBuffer)

Constructor for making a new zip file or opening from existing one.

  • @ArrayBuffer {Buffer|Uint8Array} <optional> - It can be either Node.js Buffer read from zip file or Uint8Array in web browser.

  • @ Return an instance of Minizip.

mz.list(options)

List all files in Minizip with full filepath and have password or not.

  • @options <optional>

    • @encoding {"utf8"|"buffer"} <default="utf8"> - Since the filepath may not encode in utf8. It will be handy to have an ArrayBuffer to do detection on encoding.
  • @ Return an Array. Something like this:

    [{
      filepath: "haha/abc.txt",
      crypt: true // (type: boolean)
    }]

mz.extract(filepath, options)

Extract one file.

  • @filepath {String|Buffer|Uint8Array} - Full filepath to extract.

  • @options <optional>

    • @encoding {"utf8"|"buffer"} <default="buffer"> - File can return in text.

    • @password {String|Buffer|Uint8Array} <optional>

  • @ Return a Buffer.

mz.append(filepath, data, options)

Append one file.

  • @filepath {String|Buffer|Uint8Array} - Full filepath to extract.

  • @data {String|Buffer|Uint8Array} - File data.

  • @options <optional>

    • @password {String|Buffer|Uint8Array} <optional>

    • @compressLevel {Number} <default=5> - 0: Store only. 1: Compress faster. 9: Compress better.

  • @ Return nothing.

mz.zip()

Retrive zip file.

  • @ Return a Buffer.

Notice

  1. It is synchronize.
  2. Browser require >= IE11.

minizip-asm.js's People

Contributors

rf00 avatar

Watchers

James Cloos 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.