Git Product home page Git Product logo

browserify-zlib's Issues

IE6-8 support?

What is the reason of broken tests in IE6-8 ? Can't find anything specific in your code. Pako is also ok.

Probably, you need to add es5-shim in your testing env, to have all output matrix green.

Angular 6 support (build error)

Hello,
Is the lib supported in Angular 6 because I am observing issues?

Steps to reproduce the issue

  1. Create app -> ng new my-app (use cli 6.2.6)
  2. App setup:
    package.json:
    ...
    "@angular/common": "6.1.10",
    ...
    "@angular/cli": "6.2.6",
    "browserify-zlib": "0.2.0"
    ...
    mycomponent.ts:
    // var zlib = require("browserify-zlib");
    import * as zlib from "browserify-zlib";

zlib.deflate(text, cb);

Actual behavior (issues):

  1. Module not found: Error: Can't resolve 'stream' in \node_modules\browserify-zlib\lib
  2. After installing the stream package -> Uncaught ReferenceError: global is not defined
  3. After setting (window as any).global = window; in polyfills.ts -> Cannot read property 'prototype' of undefined
  4. Tried setting "allowSyntheticDefaultImports": true in tsconfig.json -> same error as above
  5. Tried setting "paths": { "browserify-zlib": [ "node_modules/browserify-zlib/lib/index.js", "node_modules/browserify-zlib/lib/binding.js"] }, in tsconfig.json -> same error as above
    p.s. I use pako for the deflation without any issues, however, the above is still valid for this lib.

Switch to faster compression library

I've been working on a compression library fflate for the past few months. It performs quite a bit better than Pako in most circumstances for both compression and decompression of DEFLATE, implements GZIP and Zlib wrappers, and supports offloading processing to a separate Worker thread to avoid blocking. This should allow for much more similar functionality to the Node.js module.

Although the binary output for the compression methods is often vastly different from true Zlib with fflate, this shouldn't really matter, since the output is still valid and works fine. In some cases, the output is larger at the same level, but always by under 5%, and in exchange performance can increase by up to 50%. In addition, the API is completely different to that of Pako and Zlib, so this package may require a major rewrite.

Overall, browserify-zlib can weigh less, achieve higher performance, and, in some cases, act more similarly to true Node.js package (i.e. not blocking with the callback variant) using this implementation. If the maintainers are interested, I can submit a PR with the changes.

P.S. It may be of interest to update the package to use Pako 2.0 even if fflate won't work here.

/cc @browserify

package.json contains the key "main" twice

Makes VS.NodejsTools parser crash;
---> (Inner Exception #0) Microsoft.NodejsTools.Npm.PackageJsonException: Error reading package.json at 'C:\myproject\node_modules\browserify-zlib\package.json': Error reading package.json. The file may be parseable JSON but may contain objects with duplicate properties.
I suppose the second one is the good one: "main": "src/index.js",

{
  "name": "browserify-zlib",
  "version": "0.1.4",
  "description": "Full zlib module for browserify",
  "keywords": ["zlib", "browserify"],
  "main": "index.js", // duplicate key #1 here
  "directories": {
    "test": "test"
  },
  "dependencies": {
    "pako": "~0.2.0"
  },
  "devDependencies": {
    "tape": "^2.12.3",
    "brfs": "^1.0.1"
  },
  "testling": {
    "files": "test/*.js",
    "browsers": [
      "ie/6..latest",
      "chrome/22..latest",
      "firefox/16..latest",
      "safari/latest",
      "opera/11.0..latest",
      "iphone/6",
      "ipad/6",
      "android-browser/latest"
    ]
  },
  "scripts": {
    "test": "node_modules/tape/bin/tape test/*.js"
  },
  "main": "src/index.js", // duplicate key #2 here
  "author": "Devon Govett <[email protected]>",
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "git://github.com/devongovett/browserify-zlib.git"
  }
}

Thanks for the support

Error

I am getting this error
ERROR in ../node_modules/zlib/lib/zlib.js 1:0-43
Module not found: Error: Can't resolve './zlib_bindings' in 'C:\My Desktop\TRY_MERNG_ISSUE\node_modules\zlib\lib'

sync api does not work

Whenever i call sync methods which use zlibBufferSync(), I get:

# zlib (zlibBufferSync) elipses.txt 16384 {"level":6,"windowBits":15,"memLevel":8,"strategy":0} DeflateRaw -> InflateRaw
not ok 82 Error: buffer error:
  ---
    operator: error
    expected: undefined
    actual:   { [Error: buffer error: ] errno: -5, code: 'Z_BUF_ERROR' }
    stack:
      Error: buffer error:
        at Zlib._binding.onerror (/Users/stephg/Development/checkpad/browserify-zlib/src/index.js:364:17)
        at Zlib._error (/Users/stephg/Development/checkpad/browserify-zlib/src/binding.js:229:8)
        at Zlib._write (/Users/stephg/Development/checkpad/browserify-zlib/src/binding.js:187:10)
        at Zlib.writeSync (/Users/stephg/Development/checkpad/browserify-zlib/src/binding.js:136:15)
        at InflateRaw.Zlib._processChunk (/Users/stephg/Development/checkpad/browserify-zlib/src/index.js:520:31)
        at Object.zlibBufferSync (/Users/stephg/Development/checkpad/browserify-zlib/src/index.js:235:17)
        at Test.<anonymous> (/Users/stephg/Development/checkpad/browserify-zlib/test/test-zlib.js:218:37)
        at Test.bound [as _cb] (/Users/stephg/Development/checkpad/browserify-zlib/node_modules/tape/lib/test.js:60:32)
        at Test.run (/Users/stephg/Development/checkpad/browserify-zlib/node_modules/tape/lib/test.js:74:14)
        at Test.bound [as run] (/Users/stephg/Development/checkpad/browserify-zlib/node_modules/tape/lib/test.js:60:32)
  ...

This is the test:
factisresearch@734fbab

version 0.1.4 has two "main" entries.

Hi!

Would you mind re-uploading a correct package.json for the package version 0.1.4? It breaks our parsers as it contains two "main" entries.

Thank you.

-l

Use pako 2.0

Hi,

Debian project want in order to harden secrurity to use only pako >= 2

Could be possible to port ?

Error: data error: incorrect header check in the browser, but works with Node and Python

Hello,

I'm trying to serialize a large amount of JSON for a one-file web report that I want to be able to generate from within Python but have the browser decompress on the fly. I wanted to test a simple example first though but I keep getting following error:

Error: data error: incorrect header 
checkcode: "Z_DATA_ERROR"
errno: -3
message: "data error: incorrect header check"

I will refer to the files in this gist as a minimal example.
https://gist.github.com/mobiusklein/8945d55b9b0f86f2bceb

I wrote a simple gzip file builder in Python, compress.py. It generates a small file data.json.gz that is gzipped json data. To test that it can be decompressed, I wrote decompress.js, which uses the built-in Node bindings for zlib. It is able to decompress the file generated by Python.

I wrote prog.js, and prepare it for the web with browserify prog.js -o main.js, which I load in index.html. I run a SimpleHTTPServer to serve the html file and data.json.gz and the ajax request from index.html pulls in the compressed data successfully, but throws the above error when attempting to decompress.

Next, to make sure it's not something Python is leaving out, I wrote compress.js, which does the same thing, but in JavaScript again. The generated compressed file looks different, but still decompresses correctly with decompress.js. When I try to load it in the browser, I still get the same error.

I'm using Browserify 6.3.2 with Node v0.10.22, in Chrome 38. Any ideas what I should be doing differently?

installation guide?

It would be nice to have some installation instructions for this. I have no idea what to do with the code. Am I supposed to run browserify on it?

debugging Z_BUF_ERROR

I'm trying to do zlib.gunzip and I get {errno: -5, code: "Z_BUF_ERROR", stack: (...), message: "buffer error: "}

Here's the code I have

var zlib = require('browserify-zlib')
var drop = require('buffer-drop')

drop(function(err, data) {
  zlib.gunzip(data, function(err, buffer) {
    console.log(err, buffer)
  });
})

Any ideas what's wrong? I can do require('browserify-zlib').gunzip(fs.readFileSync('./file.dat')) in node w/ the same file and it works as expected

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.