@@ -31,24 +31,22 @@ const ENTITIES = {
3131} as const ;
3232
3333/** Transformer object for `TransformStream` constructed by `XMLStream` */
34- export const transformer : Transformer < Uint8Array , [ NodeType , string ] > & {
34+ export const transformer : Transformer < string , [ NodeType , string ] > & {
3535 buf : string ;
3636 state : State ;
3737 previous : [ State , number ] ;
38- decoder : TextDecoder ;
3938} = {
4039 buf : '' ,
4140 state : StateType . SKIP ,
4241 previous : [ StateType . SKIP , - 1 ] ,
43- decoder : new TextDecoder ( ) ,
4442 flush ( controller ) {
4543 // Buffer should be empty if document is well-formed
4644 if ( this . buf . length > 0 ) {
4745 controller . enqueue ( [ NodeType . TEXT , this . buf ] ) ;
4846 }
4947 } ,
5048 transform ( chunk , controller ) {
51- this . buf += this . decoder . decode ( chunk ) ;
49+ this . buf += chunk ;
5250 while ( this . buf . length ) {
5351 // Break if no progress is made (entity may straddle chunk boundary)
5452 if (
@@ -98,7 +96,7 @@ export const transformer: Transformer<Uint8Array, [NodeType, string]> & {
9896} ;
9997
10098/** Transform a binary XML stream into a stream of structured XML data */
101- export class XMLStream extends TransformStream < Uint8Array , [ NodeType , string ] > {
99+ export class XMLStream extends TransformStream < string , [ NodeType , string ] > {
102100 constructor ( ) {
103101 super ( { ...transformer } ) ;
104102 }
0 commit comments