Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Won's decompress #8

Open
hynese opened this Issue · 1 comment

1 participant

hynese
hynese

Greetings,

I have the following code:

var compress=require("./node-compress/compress");
var sys=require("sys");
//var posix=require("posix");

// Create gzip stream
var gzip=new compress.Gzip;
gzip.init();
var data="Hello world!";
sys.puts(data);
var data_deflated=gzip.deflate(data,"binary");
sys.puts(data_deflated);

var gunzip=new compress.Gunzip;
gunzip.init();
var data_inflated=gunzip.inflate(data_deflated,"binary");
sys.puts(data_inflated);

gzip.end();
gunzip.end();

I get the following output:

root@remot:/home/hynese/backopt# node gzip_test.js
Hello world!
--compressed string---

root@remote-site:/home/hynese/backopt#

As you can see, the last line should print "Hello world!", but it's just blank...

Totally stuck now...

hynese

Ok, got it to work now. Had to add gzip.end()...

var compress=require("./node-compress/compress");
var sys=require("sys");
//var posix=require("posix");

// Create gzip stream
var gzip=new compress.Gzip;
gzip.init();
var data="Hello world!";
sys.puts(data);
var data_deflated=gzip.deflate(data,"binary");
sys.puts(data_deflated);
var data_deflated=data_deflated+gzip.end();

var gunzip=new compress.Gunzip;
gunzip.init();
var data_inflated=gunzip.inflate(data_deflated,"binary");
sys.puts(data_inflated);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.