Include content delivery runtime
This commit is contained in:
1 parent
4d0980a389
commit
b5c9bce1aa
9 files changed
+809
-1
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import { registerPlugin, type PluginListenerHandle } from "@capacitor/core";
|
||||
|
||||
export interface ContentDownloadProgress {
|
||||
readonly logicalPath: string;
|
||||
readonly downloadedBytes: number;
|
||||
readonly totalBytes: number;
|
||||
}
|
||||
|
||||
export interface NativeContentFileResult {
|
||||
readonly fileUri: string;
|
||||
readonly bytes: number;
|
||||
readonly reused: boolean;
|
||||
}
|
||||
|
||||
interface DownloadOptions {
|
||||
readonly url: string;
|
||||
readonly logicalPath: string;
|
||||
readonly sha256: string;
|
||||
readonly extension: string;
|
||||
readonly bytes: number;
|
||||
}
|
||||
|
||||
interface ObjectOptions {
|
||||
readonly sha256: string;
|
||||
readonly extension: string;
|
||||
}
|
||||
|
||||
interface NativeContentStoragePlugin {
|
||||
download(options: DownloadOptions): Promise<NativeContentFileResult>;
|
||||
remove(options: ObjectOptions): Promise<void>;
|
||||
has(options: ObjectOptions & { readonly bytes: number }): Promise<{ readonly exists: boolean; readonly fileUri?: string }>;
|
||||
getFreeBytes(): Promise<{ readonly freeBytes: number }>;
|
||||
addListener(
|
||||
eventName: "downloadProgress",
|
||||
listener: (event: ContentDownloadProgress) => void,
|
||||
): Promise<PluginListenerHandle>;
|
||||
}
|
||||
|
||||
export const NativeContentStorage = registerPlugin<NativeContentStoragePlugin>("ContentStorage");
|
||||
Reference in new issue
Block a user