mirror of
https://github.com/Stef-00012/Zipline-Android-App.git
synced 2025-05-11 10:25:59 +02:00
add some other functions to manage zipline & slightly change some types
This commit is contained in:
parent
370194a486
commit
3aeb0d2816
18 changed files with 370 additions and 125 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue