Skip to content

Instantly share code, notes, and snippets.

@PhoenixIllusion
Created March 10, 2020 23:38
Show Gist options
  • Save PhoenixIllusion/7fa8f781491b3d2b0df382ced6ce9100 to your computer and use it in GitHub Desktop.
Save PhoenixIllusion/7fa8f781491b3d2b0df382ced6ce9100 to your computer and use it in GitHub Desktop.
Minified RegPack native-DecompressionStream (with pako rawDeflate fallback) Zip parser for reading ZipFile and getting Blobs of decompressed content
/*
const zip = new ZipReader(fileBlob);
await zip.parse();
console.log(zip.RECORDS);
const blob = await zip.getRecord(1);
*/
for(_=`;s++*pako@(t,eM,!0)Qco^^nst ~~e=%.p($en#e.Ye(XetW])Ki.c||i.fJ],Iif(H,2G.sFin);new ResponsX,{s:or(){this.&&(i+=awaitufferlobRECORDS)).push(async {^nstructtdocum#t.,0,0, De^mpressionStream DataView( functionUt8Array(YbyteL#gthWUt32(rWurn  a(b,GGGG,4,4,$[4K[0Kthrow Err"Error parsg #try"(()=>{"use strict"; tM,nHwdow. ~i= ("gzip"),r= 8).brF0,eQ,rF4,nQ,B([s,t,rKFtream().pipeThrough(i.b()}{(i="https://cdnjs.cloudflarY^m/ajax/libs/@/1.0.10/@_flatYm.js",PromisXMHquerySelect"script[src='"+i+"']"t(ielse{%createElem#t("script"eFrc=i,Yonload=(t(i)},gWElem#tsByTagNamX"head")[0].app#dChild(e)}};%@.flateRaw(tB([eK}var i}%TextDe^der;class nd=t,i=0}p(t~n=[];flW s=0;s<t.l#gth*~i=t[s];HiFn[iFK,J~t=n[J];i+=t;~s=d.b,i-t,tni.f?Yde^dXs):s)}2==i2,nd.gWUt16(i-2,!0),4==i4,nd.gi-4,!0)}n}}~s=[31,139,8 0 0G55K,i=[24GG8}9},{c:6}Ir=[2G4G{f:9}10}11}Io=[42Ia=M,n  tFlicXe,n.arrayB(};wdow.ZipReader=classb=t}parsXlW t;%bFize-65e3fvar s=22;s<*)101010256==Yg-sQ&&(t=n( Yb,-s$o;~i=n(t[6It[6]+t[5];=[];fs=0;s<t[4]*H33639248!=ii$r}}gWRe^rd(e~s=[eIr=s[15Io=r+s[7]+2048,c=n(bFlicXr,oH67324752!=c~h=c$i t(h[10Ih[5Ih[7K}}})()`;G=/[-F-KW-Y#-%~^QM@*]/.exec(_);)with(_.split(G))_=join(shift());eval(_)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment