var through = require('through2');

module.exports = function (file, opts) {
    var bufs = [];
    return through(write, end);
    
    function write (buf, enc, next) {
        if (!Buffer.isBuffer(buf)) buf = Buffer(buf);
        bufs.push(buf);
        next();
    }
    
    function end () {
        var str = Buffer.concat(bufs).toString('utf8');
        this.push(str.replace(/GGG/g, opts.z));
        this.push(null);
    }
};
