I think the issue is there is a max size on the nsIArrayBufferStream, so I tried to chunk it, this now gives me “bad requests” so Im not doing something right in here:
var cByteLen = 0;
var chunkSize = 7000;
while (cByteLen < v.byteLength) {
var abstream = Cc["@mozilla.org/io/arraybuffer-input-stream;1"].createInstance(Ci.nsIArrayBufferInputStream);
var thisChunkSize = cByteLen + chunkSize < v.byteLength ? cByteLen + chunkSize : v.byteLength - cByteLen;
console.error('thisChunkSize:', thisChunkSize);
abstream.setData(v, cByteLen, thisChunkSize);
cByteLen = cByteLen + thisChunkSize;
mpis.appendStream(abstream);
}