@@ -46,14 +46,6 @@ class AsynchronousIndexedDbFileSystem {
46
46
web.IDBDatabase ? _database;
47
47
final String _dbName;
48
48
49
- /// Whether to store chunks as [web.Blob] s instead of array buffers.
50
- ///
51
- /// It seems like loading blobs concurrently may be more efficient, but not
52
- /// all browsers support storing blobs in IndexedDB. We support both blobs
53
- /// and array buffers on the read path. For writes, we run a feature detection
54
- /// after opening the file system to determine whether to store blobs.
55
- bool _storeBlobs = true ;
56
-
57
49
AsynchronousIndexedDbFileSystem (this ._dbName);
58
50
59
51
bool get _isClosed => _database == null ;
@@ -87,44 +79,6 @@ class AsynchronousIndexedDbFileSystem {
87
79
final openFuture = openRequest.completeOrBlocked< web.IDBDatabase > ();
88
80
completer.complete (openFuture);
89
81
_database = await completer.future;
90
-
91
- _storeBlobs = await _supportsStoringBlobs ();
92
- }
93
-
94
- /// Probes whether the IndexedDB implementation supports storing [web.Blob]
95
- /// instances.
96
- ///
97
- /// Safari in private windows does not support storing blobs, but allows
98
- /// storing array buffers directly. Our read paths support reading blobs and
99
- /// array buffers, so we use this to determine which format to use for writes.
100
- Future <bool > _supportsStoringBlobs () async {
101
- final transaction =
102
- _database! .transaction ([_blocksStore.toJS].toJS, 'readwrite' );
103
-
104
- web.Blob blob;
105
-
106
- try {
107
- final blocks = transaction.objectStore (_blocksStore);
108
-
109
- final request = blocks.add (
110
- web.Blob ([Uint8List (4096 ).buffer.toJS].toJS),
111
- ['test' .toJS].toJS,
112
- );
113
- final key = await request.complete ();
114
-
115
- blob = await blocks.get (key).complete< web.Blob > ();
116
- } on Object {
117
- return false ;
118
- } finally {
119
- transaction.abort ();
120
- }
121
-
122
- try {
123
- await blob.byteBuffer ();
124
- return true ;
125
- } on Object {
126
- return false ;
127
- }
128
82
}
129
83
130
84
void close () {
@@ -314,8 +268,7 @@ class AsynchronousIndexedDbFileSystem {
314
268
.openCursor (web.IDBKeyRange .only ([fileId.toJS, blockStart.toJS].toJS))
315
269
.complete< web.IDBCursorWithValue ? > ();
316
270
317
- final value =
318
- _storeBlobs ? web.Blob ([block.toJS].toJS) : block.buffer.toJS;
271
+ final value = block.buffer.toJS;
319
272
320
273
if (cursor == null ) {
321
274
// There isn't, let's write a new block
0 commit comments