ki integration
This commit is contained in:
1 parent
82d98bd8cf
commit
9ecb292c26
78 files changed
+12055
-55
No files matched your search
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Datei-Upload – **native**. Gegenstück: `upload.web.ts`.
|
||||
*
|
||||
* Das native SDK will die Datei als `{name, type, size, uri}` und liest sie
|
||||
* selbst vom Dateisystem; das Web-SDK will ein `File`-Objekt. Deshalb liegt der
|
||||
* Upload genauso plattform-getrennt wie der Client selbst.
|
||||
*/
|
||||
import { ID, storage } from './appwrite';
|
||||
|
||||
export type Auswahl = {
|
||||
uri: string;
|
||||
name: string;
|
||||
mimeType: string;
|
||||
size: number;
|
||||
};
|
||||
|
||||
export async function hochladen(
|
||||
bucketId: string,
|
||||
datei: Auswahl,
|
||||
permissions: string[],
|
||||
): Promise<string> {
|
||||
const f = await storage.createFile({
|
||||
bucketId,
|
||||
fileId: ID.unique(),
|
||||
file: { name: datei.name, type: datei.mimeType, size: datei.size, uri: datei.uri },
|
||||
permissions,
|
||||
});
|
||||
return f.$id;
|
||||
}
|
||||
Reference in new issue
Block a user