mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-04-21 00:04:42 +01:00
wip: bg downloader module
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
export interface DownloadProgressEvent {
|
||||
taskId: number;
|
||||
bytesWritten: number;
|
||||
totalBytes: number;
|
||||
progress: number;
|
||||
}
|
||||
|
||||
export interface DownloadCompleteEvent {
|
||||
taskId: number;
|
||||
filePath: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface DownloadErrorEvent {
|
||||
taskId: number;
|
||||
error: string;
|
||||
}
|
||||
|
||||
export interface DownloadStartedEvent {
|
||||
taskId: number;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface ActiveDownload {
|
||||
taskId: number;
|
||||
url: string;
|
||||
state: "running" | "suspended" | "canceling" | "completed" | "unknown";
|
||||
}
|
||||
|
||||
export interface BackgroundDownloaderModuleType {
|
||||
startDownload(url: string, destinationPath?: string): Promise<number>;
|
||||
cancelDownload(taskId: number): void;
|
||||
cancelAllDownloads(): void;
|
||||
getActiveDownloads(): Promise<ActiveDownload[]>;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { requireNativeModule } from "expo-modules-core";
|
||||
import type { BackgroundDownloaderModuleType } from "./BackgroundDownloader.types";
|
||||
|
||||
const BackgroundDownloaderModule: BackgroundDownloaderModuleType =
|
||||
requireNativeModule("BackgroundDownloader");
|
||||
|
||||
export default BackgroundDownloaderModule;
|
||||
Reference in New Issue
Block a user