@@ -2,7 +2,6 @@ import { type InPG, ni } from "../../in-pg.ts";
22import type { DevType , PGFile , PGFileMem } from "../../types.ts" ;
33import { ERRNO_CODES } from "../constants.ts" ;
44import { normalizePath } from "../convert.ts" ;
5-
65import type { PGMem } from "../pgMem.ts" ;
76import { MemFile , PostgresFile } from "./pg-file.ts" ;
87
@@ -19,18 +18,16 @@ export class FileManager {
1918 tmpMap : Map < string , string > ;
2019 lastDebugMessage : string ;
2120 messageCount : number = 0 ;
22- pgFilesDir : string ;
2321 isWindows : boolean = Deno . build . os === "windows" ;
2422 tmDir ! : string ;
2523 postgresFiles : Map < string , PostgresFile > ;
2624 constructor ( inPg : InPG , options : {
2725 debug ?: boolean ;
28- pgFilesDir : string ;
26+ fileData : Uint8Array ;
2927 } ) {
3028 this . lastDebugMessage = "" ;
3129 this . dirReadOffsets = new Map ( ) ;
3230 this . debug = options ?. debug ;
33- this . pgFilesDir = options . pgFilesDir ;
3431 this . #currFD = 100 ;
3532 this . inPg = inPg ;
3633 this . mem = inPg . pgMem ;
@@ -47,11 +44,7 @@ export class FileManager {
4744 truncate : true ,
4845 } ) ;
4946 }
50- this . init ( ) ;
51- }
52-
53- init ( ) {
54- this . loadPostgresFiles ( ) ;
47+ this . loadPostgresFiles ( options . fileData ) ;
5548 this . setupStdStreams ( ) ;
5649 }
5750 clearTmp ( ) {
@@ -419,8 +412,7 @@ export class FileManager {
419412 }
420413 return null ;
421414 }
422- loadPostgresFiles ( ) {
423- const data = Deno . readFileSync ( `${ this . pgFilesDir } /src/inpg.data` ) ;
415+ loadPostgresFiles ( data : Uint8Array ) {
424416 let offset = 0 ;
425417 const view = new DataView ( data . buffer , data . byteOffset , data . byteLength ) ;
426418
0 commit comments