Initial commit: PodcastYes — AI podcast platform
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { LocalStorageProvider } from "./local";
|
||||
import type { StorageProvider } from "./types";
|
||||
|
||||
export * from "./types";
|
||||
|
||||
// Registry: today only local disk. To add S3/R2 later, implement StorageProvider
|
||||
// in lib/storage/s3.ts and switch on an env flag here — no call-site changes.
|
||||
let provider: StorageProvider | null = null;
|
||||
|
||||
export function storage(): StorageProvider {
|
||||
if (!provider) provider = new LocalStorageProvider();
|
||||
return provider;
|
||||
}
|
||||
|
||||
/** Convenience for the worker / asset route which need the on-disk path. */
|
||||
export function localStorage(): LocalStorageProvider {
|
||||
const s = storage();
|
||||
if (s instanceof LocalStorageProvider) return s;
|
||||
throw new Error("Local filesystem path requested but active storage is not local");
|
||||
}
|
||||
Reference in New Issue
Block a user