diff --git a/src/openpgp.js b/src/openpgp.js index 8fb07ef8..4c671583 100644 --- a/src/openpgp.js +++ b/src/openpgp.js @@ -629,7 +629,7 @@ async function convertStream(data, streaming) { * @returns {Object} the data in the respective format */ async function convertStreams(obj, streaming, keys=[]) { - if (Object.prototype.isPrototypeOf(obj)) { + if (Object.prototype.isPrototypeOf(obj) && !Uint8Array.prototype.isPrototypeOf(obj)) { await Promise.all(Object.entries(obj).map(async ([key, value]) => { // recursively search all children if (util.isStream(value) || keys.includes(key)) { obj[key] = await convertStream(value, streaming); diff --git a/src/util.js b/src/util.js index 495a6260..e2eff20d 100644 --- a/src/util.js +++ b/src/util.js @@ -102,7 +102,7 @@ export default { * @returns {Object} */ restoreStreams: function(obj) { - if (Object.prototype.isPrototypeOf(obj)) { + if (Object.prototype.isPrototypeOf(obj) && !Uint8Array.prototype.isPrototypeOf(obj)) { Object.entries(obj).forEach(([key, value]) => { // recursively search all children if (MessagePort.prototype.isPrototypeOf(value)) { obj[key] = new ReadableStream({