Permalink
Browse files

Fixing for newer versions of node, posix -> fs

  • Loading branch information...
1 parent f27af24 commit 6a100885c28c943deefacfb9bfe7091f630ef375 @mikeal committed Apr 25, 2010
Showing with 9 additions and 9 deletions.
  1. +1 −1 README
  2. +7 −7 filetest.js
  3. +1 −1 test.js
View
2 README
@@ -16,7 +16,7 @@ Quick example
var compress=require("./compress");
var sys=require("sys");
-var posix=require("posix");
+var fs=require("fs");
// Create gzip stream
var gzip=new compress.Gzip;
View
@@ -1,13 +1,13 @@
var compress=require("./compress");
var sys=require("sys");
-var posix=require("posix");
+var fs=require("fs");
// Read in our test file
-var data=posix.cat("filetest.js", encoding="binary").wait();
+var data=fs.cat("filetest.js", encoding="binary").wait();
sys.puts("Got : "+data.length);
// Set output file
-var fd = posix.open("filetest.js.gz", process.O_WRONLY | process.O_TRUNC | process.O_CREAT, 0644).wait();
+var fd = fs.open("filetest.js.gz", process.O_WRONLY | process.O_TRUNC | process.O_CREAT, 0644).wait();
sys.puts("Openned file");
// Create gzip stream
@@ -17,19 +17,19 @@ gzip.init();
// Pump data to be compressed
gzdata=gzip.deflate(data, "binary"); // Do this as many times as required
sys.puts("Compressed size : "+gzdata.length);
-posix.write(fd, gzdata, encoding="binary").wait();
+fs.write(fd, gzdata, encoding="binary").wait();
// Get the last bit
gzlast=gzip.end();
sys.puts("Last bit : "+gzlast.length);
-posix.write(fd, gzlast, encoding="binary").wait();
-posix.close(fd).wait();
+fs.write(fd, gzlast, encoding="binary").wait();
+fs.close(fd).wait();
sys.puts("File closed");
// See if we can uncompress it ok
var gunzip=new compress.Gunzip;
gunzip.init();
-var testdata = posix.cat("filetest.js.gz", encoding="binary").wait();
+var testdata = fs.cat("filetest.js.gz", encoding="binary").wait();
sys.puts("Test opened : "+testdata.length);
sys.puts(gunzip.inflate(testdata, "binary").length);
gunzip.end();
View
@@ -1,6 +1,6 @@
var compress=require("./compress");
var sys=require("sys");
-var posix=require("posix");
+var fs=require("fs");
// Create gzip stream
var gzip=new compress.Gzip;

0 comments on commit 6a10088

Please sign in to comment.