openIndexedDb function

Future<BlitFile> openIndexedDb(
  1. String path, {
  2. bool create = true,
  3. bool readOnly = false,
  4. int chunkSize = web.kIdbDefaultChunkSize,
  5. String databaseName = web.kIdbDatabaseName,
  6. String storeName = web.kIdbStoreName,
})

Opens an IndexedDB-backed file through the simple facade.

Implementation

Future<BlitFile> openIndexedDb(
  String path, {
  bool create = true,
  bool readOnly = false,
  int chunkSize = web.kIdbDefaultChunkSize,
  String databaseName = web.kIdbDatabaseName,
  String storeName = web.kIdbStoreName,
}) async {
  final backend = await web.openIdbBytesFile(
    path,
    create: create,
    readOnly: readOnly,
    chunkSize: chunkSize,
    databaseName: databaseName,
    storeName: storeName,
  );
  return BlitFile.fromFile(
    AsyncFile.fromBackend(
      path,
      backend,
      options: FileOptions(
        mode: readOnly ? FileMode.read : FileMode.readWrite,
        create: create,
      ),
    ),
  );
}