make storage functions async to match web
This commit is contained in:
@@ -35,10 +35,10 @@ function ensureDirectory(): void {
|
|||||||
/**
|
/**
|
||||||
* Save a media file to local storage by localRefPath key
|
* Save a media file to local storage by localRefPath key
|
||||||
*/
|
*/
|
||||||
export function saveMediaToLocal(
|
export async function saveMediaToLocal(
|
||||||
localRefPath: string,
|
localRefPath: string,
|
||||||
sourcePath: string,
|
sourcePath: string,
|
||||||
): void {
|
): Promise<void> {
|
||||||
ensureDirectory()
|
ensureDirectory()
|
||||||
|
|
||||||
const destFile = getMediaFile(localRefPath)
|
const destFile = getMediaFile(localRefPath)
|
||||||
@@ -69,7 +69,9 @@ export function saveMediaToLocal(
|
|||||||
* Load a media file path from local storage
|
* Load a media file path from local storage
|
||||||
* @returns The file URI for the saved media
|
* @returns The file URI for the saved media
|
||||||
*/
|
*/
|
||||||
export function loadMediaFromLocal(localRefPath: string): string {
|
export async function loadMediaFromLocal(
|
||||||
|
localRefPath: string,
|
||||||
|
): Promise<string> {
|
||||||
const file = getMediaFile(localRefPath)
|
const file = getMediaFile(localRefPath)
|
||||||
|
|
||||||
if (!file.exists) {
|
if (!file.exists) {
|
||||||
@@ -82,7 +84,9 @@ export function loadMediaFromLocal(localRefPath: string): string {
|
|||||||
/**
|
/**
|
||||||
* Delete a media file from local storage
|
* Delete a media file from local storage
|
||||||
*/
|
*/
|
||||||
export function deleteMediaFromLocal(localRefPath: string): void {
|
export async function deleteMediaFromLocal(
|
||||||
|
localRefPath: string,
|
||||||
|
): Promise<void> {
|
||||||
const file = getMediaFile(localRefPath)
|
const file = getMediaFile(localRefPath)
|
||||||
// Idempotent: only delete if file exists
|
// Idempotent: only delete if file exists
|
||||||
if (file.exists) {
|
if (file.exists) {
|
||||||
|
|||||||
Reference in New Issue
Block a user