I'm using a wrapper atm that makes JXG's Gzip utils a bunch easier. The unzipping a base64 encoded string part works rather nicely however I want to be able to turn it back into a base64 encoded string again. I somehow can't seem to wrap my head around it however, the function which unzips does the following:
unzipBase64AsArray: function(input, bytes) {
    bytes = bytes || 1;
    var dec = this.unzipBase64(input),
        ar = [], i, j, len;
    for (i = 0, len = dec.length/bytes; i < len; i++){
        ar[i] = 0;
        for (j = bytes-1; j >= 0; --j){
            ar[i] += dec.charCodeAt((i *bytes) +j) << (j *8);
        }
    }
    return ar;
}
Now I need to reverse that, I have my array with numbers and wish to turn it into a byte string (could do the base64 encoding and gzip compression with php).
Any idea how to reverse the function above?