MCPcopy
hub / github.com/jvilk/BrowserFS / IDBFSFactory

Function IDBFSFactory

test/harness/factories/idbfs_factory.ts:4–22  ·  view source on GitHub ↗
(cb: (name: string, obj: FileSystem[]) => void)

Source from the content-addressed store, hash-verified

2import {FileSystem} from '../../../src/core/file_system';
3
4export default function IDBFSFactory(cb: (name: string, obj: FileSystem[]) => void): void {
5 if (IndexedDBFileSystem.isAvailable()) {
6 IndexedDBFileSystem.Create({
7 storeName: `test-${Math.random()}`
8 }, (e, fs?) => {
9 if (e) {
10 throw e;
11 }
12 fs.empty((e?) => {
13 if (e) {
14 throw e;
15 }
16 cb('IndexedDB', [fs]);
17 });
18 });
19 } else {
20 cb('IndexedDB', []);
21 }
22}

Callers 1

AsyncMirrorFactoryFunction · 0.85

Calls 4

cbFunction · 0.85
isAvailableMethod · 0.65
CreateMethod · 0.65
emptyMethod · 0.45

Tested by

no test coverage detected