File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,17 +119,17 @@ const textDecoder = new TextDecoder('utf-8');
119119 * @private
120120 */
121121const decodeBase64 : ( str : string ) => string = ( ( ) => {
122- // 1) Modern Web / some runtimes
122+ // 1) Node.js (fast path)
123+ if ( typeof NodeBuffer ?. from === 'function' ) {
124+ return ( str : string ) => NodeBuffer . from ( str , 'base64' ) . toString ( 'utf-8' ) ;
125+ }
126+
127+ // 2) Modern Web / some runtimes
123128 if ( typeof ( Uint8Array as Uint8ArrayWithBase64 ) . fromBase64 === 'function' ) {
124129 return ( str : string ) =>
125130 textDecoder . decode ( ( Uint8Array as Uint8ArrayWithBase64 ) . fromBase64 ! ( str ) ) ;
126131 }
127132
128- // 2) Node.js (fast path)
129- if ( typeof NodeBuffer ?. from === 'function' ) {
130- return ( str : string ) => NodeBuffer . from ( str , 'base64' ) . toString ( 'utf-8' ) ;
131- }
132-
133133 // 3) Browser fallback
134134 return ( str : string ) => {
135135 const binary = atob ( str ) ;
You can’t perform that action at this time.
0 commit comments