File tree Expand file tree Collapse file tree 2 files changed +61
-10
lines changed Expand file tree Collapse file tree 2 files changed +61
-10
lines changed Original file line number Diff line number Diff line change
1
+ declare module "tinytar" {
2
+ interface TarFile {
3
+ name : string ;
4
+ mode ?: number ;
5
+ uid ?: number ;
6
+ gid ?: number ;
7
+ size ?: number ;
8
+ modifyTime ?: number | Date ;
9
+ checksum ?: number ;
10
+ type ?: number ;
11
+ linkName ?: string ;
12
+ ustar ?: string ;
13
+ owner ?: string ;
14
+ group ?: string ;
15
+ majorNumber ?: number ;
16
+ minorNumber ?: number ;
17
+ prefix ?: string ;
18
+ accessTime ?: number | Date ;
19
+ createTime ?: number | Date ;
20
+ data : Uint8Array ;
21
+ isOldGNUFormat ?: boolean ;
22
+ }
23
+
24
+ interface UntarOptions {
25
+ extractData ?: boolean ;
26
+ checkHeader ?: boolean ;
27
+ checkChecksum ?: boolean ;
28
+ checkFileSize ?: boolean ;
29
+ }
30
+
31
+ function tar ( files : TarFile [ ] ) : Uint8Array ;
32
+ function untar ( buffer : Uint8Array , options ?: UntarOptions ) : TarFile [ ] ;
33
+
34
+ const NULL_CHAR : string ;
35
+ const TMAGIC : string ;
36
+ const OLDGNU_MAGIC : string ;
37
+ const REGTYPE : number ;
38
+ const LNKTYPE : number ;
39
+ const SYMTYPE : number ;
40
+ const CHRTYPE : number ;
41
+ const BLKTYPE : number ;
42
+ const DIRTYPE : number ;
43
+ const FIFOTYPE : number ;
44
+ const CONTTYPE : number ;
45
+ const TSUID : number ;
46
+ const TSGID : number ;
47
+ const TSVTX : number ;
48
+ const TUREAD : number ;
49
+ const TUWRITE : number ;
50
+ const TUEXEC : number ;
51
+ const TGREAD : number ;
52
+ const TGWRITE : number ;
53
+ const TGEXEC : number ;
54
+ const TOREAD : number ;
55
+ const TOWRITE : number ;
56
+ const TOEXEC : number ;
57
+ const TPERMALL : number ;
58
+ const TPERMMASK : number ;
59
+ }
Original file line number Diff line number Diff line change
1
+ import tinyTar from "tinytar" ;
1
2
import { IN_NODE } from "./utils.js" ;
2
3
import type { PostgresMod } from "./postgres.js" ;
3
- import type { PGliteInterface } from "./interface.js" ;
4
-
5
- // @ts -ignore - tinytar has no types, we will probably replace this with another library
6
- import tinyTar from "tinytar" ;
7
4
8
5
export async function loadExtensionBundle (
9
6
bundlePath : URL ,
@@ -68,18 +65,13 @@ export async function loadExtensions(
68
65
}
69
66
}
70
67
71
- interface UntarFile {
72
- name : string ;
73
- data : Uint8Array ;
74
- }
75
-
76
68
function loadExtension (
77
69
mod : PostgresMod ,
78
70
ext : string ,
79
71
bytes : Uint8Array ,
80
72
log : ( ...args : any [ ] ) => void ,
81
73
) {
82
- const data : UntarFile [ ] = tinyTar . untar ( bytes ) ;
74
+ const data = tinyTar . untar ( bytes ) ;
83
75
data . forEach ( ( file ) => {
84
76
if ( ! file . name . startsWith ( "." ) ) {
85
77
const filePath = mod . WASM_PREFIX + "/" + file . name ;
You can’t perform that action at this time.
0 commit comments