mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-29 13:00:12 +02:00
16 lines
428 B
TypeScript
16 lines
428 B
TypeScript
import type { AbstractStorage } from "./storage";
|
|
import { MemoryStorage } from "./memory";
|
|
import { OPFSStorage } from "./opfs";
|
|
|
|
export function init(expectedSize?: number): Promise<AbstractStorage> {
|
|
if (OPFSStorage.isAvailable()) {
|
|
return OPFSStorage.init();
|
|
}
|
|
|
|
if (MemoryStorage.isAvailable()) {
|
|
return MemoryStorage.init(expectedSize || 0);
|
|
}
|
|
|
|
throw "no storage method is available";
|
|
}
|