更新记录

1.0.0(2024-12-01)

初始版本发布


平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
HBuilderX 3.6.8,Android:4.4,iOS:12,HarmonyNext:不确定 × × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序
× × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × × × × × ×

概述

XF-downloadFilesUTS插件实现多线程下载文件功能。

插件接口

SetConfig

设置线程执行数量

uni-app项目中(nvue)调用示例:

import { setConfig } from "@/uni_modules/XF-downloadFilesUTS"

setConfig(3);

uni-app x项目(uvue)中调用示例:

import { setConfig } from "@/uni_modules/XF-downloadFilesUTS";

setConfig(3);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

addListenProgress

下载进度监听

uni-app项目中(nvue)调用示例:

import { addListenProgress } from "@/uni_modules/XF-downloadFilesUTS"

addListenProgress({
    success: (res : any) => {
      console.log(res)
    }
});

uni-app x项目(uvue)中调用示例:

import { addListenProgress } from "@/uni_modules/XF-downloadFilesUTS";
import { ProgressResult, ListenProgressOptions } from "@/uni_modules/XF-downloadFilesUTS/utssdk/interface.uts";

addListenProgress({
    success: (res : ProgressResult) => {
      console.log(res)
    }
} as ListenProgressOptions);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

addListenState

下载状态监听

uni-app项目中(nvue)调用示例:

import { addListenState } from "@/uni_modules/XF-downloadFilesUTS"

addListenState({
    success: (res : any) => {
      console.log(res)
    }
});

uni-app x项目(uvue)中调用示例:

import { addListenState } from "@/uni_modules/XF-downloadFilesUTS";
import { StateResult, ListenStateOptions } from "@/uni_modules/XF-downloadFilesUTS/utssdk/interface.uts";

addListenState({
    success: (res : StateResult) => {
      console.log(res)
    }
} as ListenStateOptions);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

removeListen

移除所有监听

uni-app项目中(nvue)调用示例:

import { removeListen } from "@/uni_modules/XF-downloadFilesUTS"

removeListen();

uni-app x项目(uvue)中调用示例:

import { removeListen } from "@/uni_modules/XF-downloadFilesUTS";

removeListen();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

loadTasks

获取所有的任务

uni-app项目中(nvue)调用示例:

import { loadTasks } from "@/uni_modules/XF-downloadFilesUTS"

loadTasks();

uni-app x项目(uvue)中调用示例:

import { loadTasks } from "@/uni_modules/XF-downloadFilesUTS";

loadTasks();

可用性

iOS、Android系统

可提供的1.0.0及更高版本

creatTask

创建单个下载任务

uni-app项目中(nvue)调用示例:

import { creatTask } from "@/uni_modules/XF-downloadFilesUTS"

creatTask({
    url: "https://file.tyousan.top/bbb_sunflower_2160p_60fps_normal.mp4",
    fileName: "bbb_sunflower_2160p_60fps_normal.mp4",
    success: (res : any) => {
      console.log(res)
    }
});

uni-app x项目(uvue)中调用示例:

import { creatTask } from "@/uni_modules/XF-downloadFilesUTS";
import { CreatTaskResult, CreatTaskOptions } from "@/uni_modules/XF-downloadFilesUTS/utssdk/interface.uts";

creatTask({
    url: "https://file.tyousan.top/bbb_sunflower_2160p_60fps_normal.mp4",
    fileName: "bbb_sunflower_2160p_60fps_normal.mp4",
    success: (res : CreatTaskResult) => {
      console.log(res)
    }
} as CreatTaskOptions);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

creatTasks

创建多个下载任务

uni-app项目中(nvue)调用示例:

import { creatTasks } from "@/uni_modules/XF-downloadFilesUTS"

creatTasks({
    dataList: [{
        url: "https://file.tyousan.top/bbb_sunflower_2160p_60fps_normal.mp4",
        fileName: "bbb_sunflower_2160p_60fps_normal.mp4",
    }],
    success: (res : any) => {
      console.log(res)
    }
});

uni-app x项目(uvue)中调用示例:

import { creatTasks } from "@/uni_modules/XF-downloadFilesUTS";
import { TasksItem, CreatTasksResult, CreatTasksOptions } from "@/uni_modules/XF-downloadFilesUTS/utssdk/interface.uts";

creatTasks({
    dataList: [{
        url: "https://file.tyousan.top/bbb_sunflower_2160p_60fps_normal.mp4",
        fileName: "bbb_sunflower_2160p_60fps_normal.mp4",
    }] as TasksItem[],
    success: (res : CreatTasksResult) => {
      console.log(res)
    }
} as CreatTasksOptions);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

pauseTaskWithId

暂停单个下载任务

uni-app项目中(nvue)调用示例:

import { pauseTaskWithId } from "@/uni_modules/XF-downloadFilesUTS"

pauseTaskWithId({
    taskId: "c8eaa7d66f0b53f276a28f61a9251717",
    success: (res : any) => {
      console.log(res)
    }
});

uni-app x项目(uvue)中调用示例:

import { pauseTaskWithId } from "@/uni_modules/XF-downloadFilesUTS";
import { TaskOptions } from "@/uni_modules/XF-downloadFilesUTS/utssdk/interface.uts";

pauseTaskWithId({
    taskId: "c8eaa7d66f0b53f276a28f61a9251717",
    success: (res : any) => {
      console.log(res)
    }
} as TaskOptions);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

removeTaskWithId

移除单个下载任务

uni-app项目中(nvue)调用示例:

import { removeTaskWithId } from "@/uni_modules/XF-downloadFilesUTS"

removeTaskWithId({
    taskId: "c8eaa7d66f0b53f276a28f61a9251717",
    success: (res : any) => {
      console.log(res)
    }
});

uni-app x项目(uvue)中调用示例:

import { removeTaskWithId } from "@/uni_modules/XF-downloadFilesUTS";
import { TaskOptions } from "@/uni_modules/XF-downloadFilesUTS/utssdk/interface.uts";

removeTaskWithId({
    taskId: "c8eaa7d66f0b53f276a28f61a9251717",
    success: (res : any) => {
      console.log(res)
    }
} as TaskOptions);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

retryTaskWidthId

失败重新下载任务

uni-app项目中(nvue)调用示例:

import { retryTaskWidthId } from "@/uni_modules/XF-downloadFilesUTS"

retryTaskWidthId({
    taskId: "c8eaa7d66f0b53f276a28f61a9251717",
    success: (res : any) => {
      console.log(res)
    }
});

uni-app x项目(uvue)中调用示例:

import { retryTaskWidthId } from "@/uni_modules/XF-downloadFilesUTS";
import { TaskOptions } from "@/uni_modules/XF-downloadFilesUTS/utssdk/interface.uts";

retryTaskWidthId({
    taskId: "c8eaa7d66f0b53f276a28f61a9251717",
    success: (res : any) => {
      console.log(res)
    }
} as TaskOptions);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

resumeTaskWithId

暂停后恢复下载任务

uni-app项目中(nvue)调用示例:

import { resumeTaskWithId } from "@/uni_modules/XF-downloadFilesUTS"

resumeTaskWithId({
    taskId: "c8eaa7d66f0b53f276a28f61a9251717",
    success: (res : any) => {
      console.log(res)
    }
});

uni-app x项目(uvue)中调用示例:

import { resumeTaskWithId } from "@/uni_modules/XF-downloadFilesUTS";
import { TaskOptions } from "@/uni_modules/XF-downloadFilesUTS/utssdk/interface.uts";

resumeTaskWithId({
    taskId: "c8eaa7d66f0b53f276a28f61a9251717",
    success: (res : any) => {
      console.log(res)
    }
} as TaskOptions);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

pauseAllDownloadTask

暂停所有下载任务

uni-app项目中(nvue)调用示例:

import { pauseAllDownloadTask } from "@/uni_modules/XF-downloadFilesUTS"

pauseAllDownloadTask({
    success: (res : any) => {
      console.log(res)
    }
});

uni-app x项目(uvue)中调用示例:

import { pauseAllDownloadTask } from "@/uni_modules/XF-downloadFilesUTS";
import { TaskAllOptions } from "@/uni_modules/XF-downloadFilesUTS/utssdk/interface.uts";

pauseAllDownloadTask({
    success: (res : any) => {
      console.log(res)
    }
} as TaskAllOptions);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

resumeAllDownloadTask

恢复所有下载任务

uni-app项目中(nvue)调用示例:

import { resumeAllDownloadTask } from "@/uni_modules/XF-downloadFilesUTS"

resumeAllDownloadTask({
    success: (res : any) => {
      console.log(res)
    }
});

uni-app x项目(uvue)中调用示例:

import { resumeAllDownloadTask } from "@/uni_modules/XF-downloadFilesUTS";
import { TaskAllOptions } from "@/uni_modules/XF-downloadFilesUTS/utssdk/interface.uts";

resumeAllDownloadTask({
    success: (res : any) => {
      console.log(res)
    }
} as TaskAllOptions);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

removeAllTask

晴空所有下载任务

uni-app项目中(nvue)调用示例:

import { removeAllTask } from "@/uni_modules/XF-downloadFilesUTS"

removeAllTask({
    success: (res : any) => {
      console.log(res)
    }
});

uni-app x项目(uvue)中调用示例:

import { removeAllTask } from "@/uni_modules/XF-downloadFilesUTS";
import { TaskAllOptions } from "@/uni_modules/XF-downloadFilesUTS/utssdk/interface.uts";

removeAllTask({
    success: (res : any) => {
      console.log(res)
    }
} as TaskAllOptions);

可用性

iOS、Android系统

可提供的1.0.0及更高版本

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问