add some other functions to manage zipline & slightly change some types

This commit is contained in:
Stef-00012 2025-01-22 00:29:07 +01:00
parent 370194a486
commit 3aeb0d2816
No known key found for this signature in database
GPG key ID: 28BE9A9E4EF0E6BF
18 changed files with 370 additions and 125 deletions

View file

@ -1,5 +1,6 @@
import mimetypesJSON from "@/assets/mimetypes.json";
import type { Mimetypes } from "@/types/mimetypes";
import * as FileSystem from "expo-file-system";
const mimetypes = mimetypesJSON as Mimetypes;
@ -33,3 +34,13 @@ export function convertToBlob(data: string): Blob {
return blob;
}
export async function getFileDataURI(filePath: string): Promise<string | null> {
const base64Data = await FileSystem.readAsStringAsync(filePath, {
encoding: FileSystem.EncodingType.Base64,
});
const dataURI = `data:image/jpg;base64,${base64Data}`;
return dataURI;
}