File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 34
34
tr .open-file + tr .details td { border-left : 4px solid # a3d8ff ; }
35
35
@media (max-width : 600px ) { table { display : block; overflow-x : auto; white-space : nowrap; } th { top : 0 ; } }
36
36
</ style >
37
+ < script >
38
+ window [ "stream/web" ] = { ReadableStream, TransformStream, WritableStream } ;
39
+ </ script >
40
+ < script src ="
https://cdn.jsdelivr.net/npm/[email protected] /dist/package/xz-decompress.js "
> </ script >
37
41
</ head >
38
42
< body >
39
43
< header >
137
141
}
138
142
139
143
async function fetchText ( url ) {
140
- if ( url . pathname . endsWith ( '.xz' ) ) throw new Error ( '.xz compression not supported' ) ;
141
144
const res = await fetch ( url ) ;
142
145
if ( ! res . ok ) throw new Error ( 'HTTP ' + res . status ) ;
146
+ if ( url . pathname . endsWith ( '.xz' ) ) {
147
+ const xz = window [ 'xz-decompress' ] ;
148
+ if ( ! xz ?. XzReadableStream ) throw new Error ( 'xz not supported in this browser' ) ;
149
+ const stream = new xz . XzReadableStream ( res . body ) ;
150
+ return await new Response ( stream ) . text ( ) ;
151
+ }
143
152
if ( url . pathname . endsWith ( '.gz' ) ) {
144
153
if ( ! ( 'DecompressionStream' in window ) ) throw new Error ( 'gzip not supported in this browser' ) ;
145
154
const ds = new DecompressionStream ( 'gzip' ) ;
391
400
const pathVal = pathInput . value . trim ( ) ;
392
401
if ( ! pathVal ) { status ( 'Path required' ) ; filesData = [ ] ; renderSummary ( ) ; renderTable ( ) ; return ; }
393
402
if ( ! params . get ( 'srcRoot' ) ) {
394
- const m = pathVal . match ( / [ \\ / ] ( [ 0 - 9 a - f ] { 40 } ) [ \\ / ] l c o v \. i n f o $ / ) ;
403
+ const m = pathVal . match ( / [ \\ / ] ( [ 0 - 9 a - f ] { 40 } ) [ \\ / ] l c o v \. i n f o (?: \. g z | \. x z ) ? $ / ) ;
395
404
srcRoot = m ? `https://raw.githubusercontent.com/gluesql/gluesql/${ m [ 1 ] } /` : '' ;
396
405
}
397
406
status ( 'Loading...' ) ;
You can’t perform that action at this time.
0 commit comments