minigame-std
    Preparing search index...

    Interface DownloadFileOptions

    下载文件的选项。

    1.0.0

    import { fs, type DownloadFileOptions } from 'minigame-std';

    const options: DownloadFileOptions = {
    onProgress: (progress) => console.log(`下载进度: ${progress.progress}%`),
    };
    const task = fs.downloadFile('https://example.com/file.zip', '/path/to/save.zip', options);
    interface DownloadFileOptions {
        complete?: DownloadFileCompleteCallback;
        enableHttp2?: boolean;
        enableProfile?: boolean;
        enableQuic?: boolean;
        header?: IAnyObject;
        onProgress?: (progressResult: IOResult<FetchProgress>) => void;
        timeout?: number;
    }

    Hierarchy

    • Omit<WechatMinigame.DownloadFileOption, "url" | "filePath" | "success" | "fail">
      • DownloadFileOptions
    Index

    Properties

    complete?: DownloadFileCompleteCallback

    接口调用结束的回调函数(调用成功、失败都会执行)

    enableHttp2?: boolean

    需要基础库: 2.10.4

    是否开启 http2

    enableProfile?: boolean

    是否开启 profile。iOS 和 Android 端默认开启,其他端暂不支持。开启后可在接口回调的 res.profile 中查看性能调试信息。

    enableQuic?: boolean

    需要基础库: 2.10.4

    是否开启 Quic/h3 协议(iOS 微信目前使用 gQUIC-Q43;Android 微信在 v8.0.54 前使用 gQUIC-Q43,v8.0.54 开始使用 IETF QUIC,即 h3 协议;PC微信使用 IETF QUIC,即 h3 协议)

    header?: IAnyObject

    HTTP 请求的 Header,Header 中不能设置 Referer

    onProgress?: (progressResult: IOResult<FetchProgress>) => void
    timeout?: number

    需要基础库: 2.10.0

    超时时间,单位为毫秒,默认值为 60000 即一分钟。