@@ -624,7 +624,7 @@ function newStreamReadableFromReadableStream(readableStream, options = kEmptyObj
624624
625625/**
626626 * @param {Duplex } duplex
627- * @param {{ type ?: 'bytes' } } [options]
627+ * @param {{ readableType ?: 'bytes' } } [options]
628628 * @returns {ReadableWritablePair }
629629 */
630630function newReadableWritablePairFromDuplex ( duplex , options = kEmptyObject ) {
@@ -641,9 +641,15 @@ function newReadableWritablePairFromDuplex(duplex, options = kEmptyObject) {
641641
642642 validateObject ( options , 'options' ) ;
643643
644+ const readableOptions = {
645+ __proto__ : null ,
646+ // DEP0201: 'options.type' is a deprecated alias for 'options.readableType'
647+ type : options . readableType ?? options . type ,
648+ } ;
649+
644650 if ( isDestroyed ( duplex ) ) {
645651 const writable = new WritableStream ( ) ;
646- const readable = new ReadableStream ( { type : options . type } ) ;
652+ const readable = new ReadableStream ( { type : readableOptions . type } ) ;
647653 writable . close ( ) ;
648654 readable . cancel ( ) ;
649655 return { readable, writable } ;
@@ -659,8 +665,8 @@ function newReadableWritablePairFromDuplex(duplex, options = kEmptyObject) {
659665
660666 const readable =
661667 isReadable ( duplex ) ?
662- newReadableStreamFromStreamReadable ( duplex , options ) :
663- new ReadableStream ( { type : options . type } ) ;
668+ newReadableStreamFromStreamReadable ( duplex , readableOptions ) :
669+ new ReadableStream ( { type : readableOptions . type } ) ;
664670
665671 if ( ! isReadable ( duplex ) )
666672 readable . cancel ( ) ;
0 commit comments