UNPKG

metawrite

Version:

Appwrite SDK with ready to go components for Svelte / SvelteKit

56 lines (55 loc) 1.71 kB
import { SvelteComponentTyped } from "svelte"; declare const __propDef: { props: {}; events: { upload: CustomEvent<any>; success: CustomEvent<any>; failure: CustomEvent<any>; } & { [evt: string]: CustomEvent<any>; }; slots: { default: { actions: { create: (bucketId: string, fileId: string, file: File, read?: string[], write?: string[]) => Promise<import("appwrite").Models.File>; }; }; }; }; export declare type StorageProps = typeof __propDef.props; export declare type StorageEvents = typeof __propDef.events; export declare type StorageSlots = typeof __propDef.slots; /** * ### `<Storage />` * * #### Directives * * **let:actions** * | Name | Description | * | --- | --- | * | `create(bucketId, fileId, file, read, write)` | Uploads a file. <br />`fileId` is required `@type - {string}`, `"unique()"` will generate random unique id, but you can use custom.<br />`file` is `@type - {File}` and required.<br />`read`/`write` is `@type - {string[]}` and *optional* | * * #### Example * * ```svelte * <script lang="ts"> * import { Storage } from "metawrite" * * // Required * let bucketId = "default" * let file: File; * let fileId = "unique()"; // this will generate random unique id, but you can use custom * * // Optional * let read: string[]; * let write: string[]; * </script> * * <Storage {file} let:actions> * <button on:click={actions.create(bucketId, fileId, file, read, write)}>Upload File</button> * </Storage> * ``` */ export default class Storage extends SvelteComponentTyped<StorageProps, StorageEvents, StorageSlots> { } export {};