Hi I understand that Concat is possible with Gzip function on OS File system,
i.e.
gzip -c a.txt > a.gzip
gzip -c b.txt > b.gzip
now below is also correct,
cat a.txt b.txt | gzip -c > ab.gzip # is same as
cat a.gzip b.gzip > ab.gzip
At file system this seems correct to me, but when I try to implement the same concept with node.js to concat, header (pre-gzipped content), main-content (pre-gzip), side-bar and other widgets which are pre-gzip binary data files on filesystem than it doesn't seem working for me, I can only see text content of first chunk (header) and other appended content displayed as random binary symbols.
First want to understand is it possible and if yes then how can I implement fragmented caching.
I just want to see if it is possible with compressed fragmented caching, otherwise plan B is to use plain fragmented caching and gzip content runtime.
var rs1 = fs.createReadStream('./node_fs/index/index.txt.gz');
var rs2 = fs.createReadStream('./node_fs/index/content.txt.gz');
res.write(rs1);
res.write(rs2);
Additionally, both files are compressed using gzip.exe command line and if I write only one of them than it works fine, but append doesn't work.
Your original gzip example "works" because the gunzip tool is written to handle multiple entries in a single file. It doesn't work with some browsers because they expect a single gzip entry.
See: Concatenate multiple zlib compressed data streams into a single stream efficiently