@@ -5,8 +5,8 @@ import { InstantiationProgress } from './progress';
5
5
import { DuckDBBindings } from './bindings_interface' ;
6
6
import { DuckDBConnection } from './connection' ;
7
7
import { 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' ;
10
10
import { ScriptTokens } from './tokens' ;
11
11
import { FileStatistics } from './file_stats' ;
12
12
import { arrowToSQLField , arrowToSQLType } from '../json_typedef' ;
@@ -469,9 +469,9 @@ export abstract class DuckDBBindingsBase implements DuckDBBindings {
469
469
}
470
470
dropResponseBuffers ( this . mod ) ;
471
471
}
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 > {
473
473
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 ) ;
475
475
for ( const item of list ) {
476
476
const { handle, path : filePath , fromCached } = item ;
477
477
if ( ! fromCached && handle . getSize ( ) ) {
@@ -483,9 +483,9 @@ export abstract class DuckDBBindingsBase implements DuckDBBindings {
483
483
throw new Error ( `prepareFileHandle: unsupported protocol ${ protocol } ` ) ;
484
484
}
485
485
/** 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 > {
487
487
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 ) ;
489
489
for ( const item of list ) {
490
490
const { handle, path : filePath , fromCached } = item ;
491
491
if ( ! fromCached && handle . getSize ( ) ) {
@@ -655,9 +655,9 @@ export abstract class DuckDBBindingsBase implements DuckDBBindings {
655
655
return copy ;
656
656
}
657
657
/** 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 > {
659
659
if ( file . startsWith ( "opfs://" ) ) {
660
- return await this . prepareFileHandle ( file , DuckDBDataProtocol . BROWSER_FSACCESS ) ;
660
+ return await this . prepareFileHandle ( file , DuckDBDataProtocol . BROWSER_FSACCESS , accesssMode , multiWindowMode ) ;
661
661
} else {
662
662
throw new Error ( "Not an OPFS file name: " + file ) ;
663
663
}
0 commit comments