Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Won's decompress #8

Open
ghost opened this issue Jun 24, 2011 · 1 comment
Open

Won's decompress #8

ghost opened this issue Jun 24, 2011 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 24, 2011

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

@ghost
Copy link
Author

ghost commented Jun 24, 2011

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants