File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 getMinecraftVersions ,
88} from "./meta_maven_utils.js" ;
99
10- import { decompressSync } from "https://cdn.skypack.dev/fflate@0.8.2?min" ;
1110import * as tiny from "./tiny_mappings.js" ;
1211
1312( async ( ) => {
@@ -59,9 +58,26 @@ import * as tiny from "./tiny_mappings.js";
5958 // Convert to Uint8Array
6059 return new Uint8Array ( arrayBuffer ) ;
6160 } ) ;
62- const decompressed = decompressSync ( arrayBuf ) ;
63- const decoder = new TextDecoder ( "utf-8" ) ;
64- const file = decoder . decode ( decompressed ) ;
61+
62+ const readableStream = new ReadableStream ( {
63+ start ( controller ) {
64+ controller . enqueue ( arrayBuf ) ;
65+ controller . close ( ) ;
66+ }
67+ } ) ;
68+ const ds = new DecompressionStream ( "gzip" ) ;
69+ const tds = new TextDecoderStream ( "utf-8" )
70+
71+ let file = '' ;
72+ const reader = readableStream . pipeThrough ( ds ) . pipeThrough ( tds ) . getReader ( ) ;
73+ while ( true ) {
74+ const { done, value } = await reader . read ( ) ;
75+ if ( done ) {
76+ break ;
77+ }
78+ file += value ;
79+ }
80+
6581 return tiny . parseTiny ( file ) ;
6682 }
6783
You can’t perform that action at this time.
0 commit comments