Git Product home page Git Product logo

js-inflate's People

Contributors

augustl 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-inflate's Issues

Decompression of string starting with '<'

I've compressed following string using DeflateStream in C# :"<Some test string"

Base64 output is this: swnOz01VKEktLlEoLinKzEsHAA==

But this string won't inflate (or any other string which starts with < like html document).

If I try with string "Some test string"
its compressed to: C87PTVUoSS0uUSguKcrMSwcA
and it works just fine.

JSInflate.inflate not working

For a zip with xml file alone I got the entry properly but if I give that as input for inflate uncompressed = JSInflate.inflate(entry.data); (where entry = unzipper.entries[0]). I am getting uncompressed data as empty.

i.e. inflate is resulting empty data.

Please review and suggest.

Seems to infinite-loop

I may be doing something incredibly wrong, but I figured I'd post this in case you've seen it before. I cannot seem to get this library to work with any of my zip files. Whenever I call JSInflate.inflate on a zipped entry (from the js-unzip library), my processor gets pegged at 100% and it seems to be causing an infinite loop in this: while((i = zip_inflate_internal(buff, 0, buff.length)) > 0)

Here is my full code:

$('input:file').live('change', function() {
  var file = this.files[0],
  r = new FileReader();

  r.onload = function(e) {
    var unzipper = new JSUnzip(r.result);

    if (unzipper.isZipFile()) {
      unzipper.readEntries();
      for (var i = 0, var len = unzipper.entries.length; i < len; i++) {
        var entry = unzipper.entries[i];
        getEntry(entry);
      }
    }

  r.readAsBinaryString(file);
});

getEntry = function(entry) {
  var uncompressed;
  if (entry.fileName.match(/some_file_name/)) {
    if (entry.compressionMethod == 0) {
      // Uncompressed
      uncompressed = entry.data
    } else if (entry.compressionMethod == 8) {
      // Deflated
      console.log('inflating...');
      uncompressed = JSInflate.inflate(entry.data);
      console.log(uncompressed);
    }
};

As you can see, I'm only trying to uncompress one file within the Zip (and it's a small 1.5KB text file). It get's to the inflating... line, but that's when the CPU gets pegged in Chrome (in FF, it'll say the script has stopped responding). Putting some debug code in js-inflate, it looks like the aforementioned line is infinite-looping.

Also, I tried the dankogai/js-deflate library, and it does the exact same thing.

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.