src/openpgp.js
function linkStreams(result, message, erroringStream) {
  result.data = stream.transformPair(message.packets.stream, async (readable, writable) => {
    await stream.pipe(result.data, writable, {
      preventClose: true
    });
    const writer = stream.getWriter(writable);
    try {
      // Forward errors in erroringStream (defaulting to the message stream) to result.data.
      await stream.readToEnd(erroringStream || readable, arr => arr);
      await writer.close();
    } catch(e) {
      await writer.abort(e);
    }
  });
}
function linkStreams(result, message, erroringStream) {
  result.data = stream.transformPair(message.packets.stream, async (readable, writable) => {
    await stream.pipe(result.data, writable, {
      preventClose: true
    });
    const writer = stream.getWriter(writable);
    try {
      // Forward errors in erroringStream (defaulting to the message stream) to result.data.
      await stream.readToEnd(erroringStream || readable, arr => arr);
      await writer.close();
    } catch(e) {
      await writer.abort(e);
    }
  });
}
function linkStreams ( result , message , erroringStream ) { result . data = stream . transformPair ( message . packets . stream , async ( readable , writable ) => { await stream . pipe ( result . data , writable , { preventClose : true } ) ; const writer = stream . getWriter ( writable ) ; try { // Forward errors in erroringStream (defaulting to the message stream) to result.data. await stream . readToEnd ( erroringStream || readable , arr => arr ) ; await writer . close ( ) ; } catch ( e ) { await writer . abort ( e ) ; } } ) ; }
Link result.data to the message stream for cancellation.
Also, forward errors in the message to result.data.
@param  {Object} result                  the data to convert
@param  {Message} message                message object
@param  {ReadableStream} erroringStream  (optional) stream which either errors or gets closed without data
@returns {Object}
Link result . data to the message stream for cancellation . Also forward errors in the message to result . data .