@@ -5,8 +5,8 @@ import { InstantiationProgress } from './progress';
55import { DuckDBBindings } from './bindings_interface' ;
66import { DuckDBConnection } from './connection' ;
77import { StatusCode } from '../status' ;
8- import { dropResponseBuffers , DuckDBRuntime , readString , callSRet , copyBuffer , DuckDBDataProtocol } from './runtime' ;
9- import { CSVInsertOptions , JSONInsertOptions , ArrowInsertOptions } from './insert_options' ;
8+ import { callSRet , copyBuffer , dropResponseBuffers , DuckDBDataProtocol , DuckDBRuntime , readString } from './runtime' ;
9+ import { ArrowInsertOptions , CSVInsertOptions , JSONInsertOptions } from './insert_options' ;
1010import { ScriptTokens } from './tokens' ;
1111import { FileStatistics } from './file_stats' ;
1212import { arrowToSQLField , arrowToSQLType } from '../json_typedef' ;
@@ -469,9 +469,9 @@ export abstract class DuckDBBindingsBase implements DuckDBBindings {
469469 }
470470 dropResponseBuffers ( this . mod ) ;
471471 }
472- public async prepareFileHandle ( fileName : string , protocol : DuckDBDataProtocol , accessMode ? : DuckDBAccessMode ) : Promise < void > {
472+ public async prepareFileHandle ( fileName : string , protocol : DuckDBDataProtocol , accessMode : DuckDBAccessMode , multiWindowMode : boolean ) : Promise < void > {
473473 if ( protocol === DuckDBDataProtocol . BROWSER_FSACCESS && this . _runtime . prepareFileHandles ) {
474- const list = await this . _runtime . prepareFileHandles ( [ fileName ] , DuckDBDataProtocol . BROWSER_FSACCESS , accessMode ) ;
474+ const list = await this . _runtime . prepareFileHandles ( [ fileName ] , DuckDBDataProtocol . BROWSER_FSACCESS , accessMode , multiWindowMode ) ;
475475 for ( const item of list ) {
476476 const { handle, path : filePath , fromCached } = item ;
477477 if ( ! fromCached && handle . getSize ( ) ) {
@@ -483,9 +483,9 @@ export abstract class DuckDBBindingsBase implements DuckDBBindings {
483483 throw new Error ( `prepareFileHandle: unsupported protocol ${ protocol } ` ) ;
484484 }
485485 /** Prepare a file handle that could only be acquired aschronously */
486- public async prepareDBFileHandle ( path : string , protocol : DuckDBDataProtocol , accessMode ? : DuckDBAccessMode ) : Promise < void > {
486+ public async prepareDBFileHandle ( path : string , protocol : DuckDBDataProtocol , accessMode : DuckDBAccessMode , multiWindowMode : boolean ) : Promise < void > {
487487 if ( protocol === DuckDBDataProtocol . BROWSER_FSACCESS && this . _runtime . prepareDBFileHandle ) {
488- const list = await this . _runtime . prepareDBFileHandle ( path , DuckDBDataProtocol . BROWSER_FSACCESS , accessMode ) ;
488+ const list = await this . _runtime . prepareDBFileHandle ( path , DuckDBDataProtocol . BROWSER_FSACCESS , accessMode , multiWindowMode ) ;
489489 for ( const item of list ) {
490490 const { handle, path : filePath , fromCached } = item ;
491491 if ( ! fromCached && handle . getSize ( ) ) {
@@ -655,9 +655,9 @@ export abstract class DuckDBBindingsBase implements DuckDBBindings {
655655 return copy ;
656656 }
657657 /** Enable tracking of file statistics */
658- public async registerOPFSFileName ( file : string ) : Promise < void > {
658+ public async registerOPFSFileName ( file : string , accesssMode : DuckDBAccessMode = DuckDBAccessMode . READ_WRITE , multiWindowMode : boolean = false ) : Promise < void > {
659659 if ( file . startsWith ( "opfs://" ) ) {
660- return await this . prepareFileHandle ( file , DuckDBDataProtocol . BROWSER_FSACCESS ) ;
660+ return await this . prepareFileHandle ( file , DuckDBDataProtocol . BROWSER_FSACCESS , accesssMode , multiWindowMode ) ;
661661 } else {
662662 throw new Error ( "Not an OPFS file name: " + file ) ;
663663 }
0 commit comments