Giter Site home page Giter Site logo

zip's Introduction

ZIP

Build Status Build status NPM version Dependency Status npm

var ZIP = require('zip');
var data = new Buffer(...);
var reader = ZIP.Reader(data);

reader.toObject(charset_opt);
reader.forEach(function (entry) {});
reader.iterator();

Copyright 1999 Masanao Izumo [email protected] License Unknown Copyright 2010 Tom Robinson (http://tlrobinson.net/) MIT License (enclosed) Copyright 2011 Kristopher Michael Kowal MIT License (enclosed)

zip's People

Contributors

amilajack avatar deathcap avatar helios175 avatar kriskowal avatar leric avatar mithgol avatar steffenmllr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

zip's Issues

question : Unable to find end of central directory record

I have some zipfile saying "Unable to find end of central directory record"

        var ZIP = require('zip');
        var data = Buffer.from(r)
        var reader = ZIP.Reader(data);

        //console.log(reader)

        reader.forEach(function (entry) {              <= here on the forEach
            console.log(entry)
        });

I can unzip them with the linux unzip command, but not with this tool (nor any other I can found)

The linux unzipping say :

unzip -o sortie_xxar400.zip
Archive:  sortie_xxar400.zip
warning [sortie_xxar400.zip]:  22787 extra bytes at beginning or within zipfile
  (attempting to process anyway)
  inflating: 3128340.log
  inflating: ESS_O_3128340_BIP.text
  inflating: ESS_O_3128340_BIP.xml

Is there's a way to "force" the unzipping (attempting to process anyway) in typescript ?

Thanks

zip file_mod date time to JavaScript Date

Here is some code you could add to decode the file_mod date and time components back into JavaScript Date object. Tested to work with all dates after 1980 due to zip encoding.

var decodeZipDateTime = function(date, time){
var year = (date>>>9)+1980,
month = ((date>>>5)&15)-1,
day = (date)&31,
hours = (time>>>11)&31,
minutes = (time>>>5)&63,
seconds = (time&63)*2;
return {
year: year,
month: month,
day: day,
hours: hours,
minutes: minutes,
seconds: seconds,
date: new Date(year, month, day, hours, minutes, seconds)
};
}

Unsupported inflate method

I'm using the https://github.com/ctalkington/node-archiver module to create zips.
It uses zlib.

When I try to uncompress using zip it fails to inflate certain files in the archive due to not being able to handle method == 3.

Refer block inflate.js:700, resulting in 0 bytes being returned from getData() to default condition in inflate.js:719

Exception on require zip

just by doing

var ZIP = require("zip");

I get the following exception:

TypeError: undefined is not a function
  at CALL_NON_FUNCTION (native)
  at Object.<anonymous> (/Users/talgiat/projects/blu/node_modules/q-io/buffer-io.js:4:10)
  at Module._compile (module.js:383:26)
  at Object..js (module.js:389:10)
  at Module.load (module.js:315:31)
  at Function._load (module.js:276:12)
  at require (module.js:327:19)
  at Object.<anonymous> (/Users/talgiat/projects/blu/node_modules/zip/lib/inflate.js:8:16)
  at Module._compile (module.js:383:26)
  at Object..js (module.js:389:10)

Memory efficient unzip

It would be nice to support unzipping large files without using too much memory. To do this, the Reader could support using a file descriptor instead of a buffer which would use fs.fstatSync(fd).size to get file size and fs.readSync(fs, buffer, 0, length, this._offset) to read from file.

To handle large files in an archive, the iterator should not decompress the data. It will just have metadata and allow the callback to call functions that save the data to a file, read it to a buffer or ignore it as required.

Doc Update required

In the example doc, the line:

var reader = ZIP.Reader(data);

Should be

var reader = new ZIP.Reader(data);

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.