Options
All
  • Public
  • Public/Protected
  • All
Menu

文件下载类

Hierarchy

  • FileDownloader

Implements

Index

Constructors

constructor

Properties

DEFAULT_PARAMS

DEFAULT_PARAMS: { autoStart: boolean; body: any; contentType: boolean; contentTypeDetermination: boolean; forceDesktopMode: boolean; headers: any[]; method: string; nameCallback: (name: any) => any; nativeFallbackOnError: boolean; timeout: number; withCredentials: boolean } = ...

默认值

Type declaration

  • autoStart: boolean
  • body: any
  • contentType: boolean
  • contentTypeDetermination: boolean
  • forceDesktopMode: boolean
  • headers: any[]
  • method: string
  • nameCallback: (name: any) => any
      • (name: any): any
      • Parameters

        • name: any

        Returns any

  • nativeFallbackOnError: boolean
  • timeout: number
  • withCredentials: boolean

body

body: any

contentType

contentType: string | false

content-type

contentTypeDetermination

contentTypeDetermination: false | "header" | "signature" | "full"

customFileSignatures

customFileSignatures: {}

Type declaration

  • [key: string]: string

Private downloadedFile

downloadedFile: Blob

filename

filename: string

文件名

forceDesktopMode

forceDesktopMode: any

headers

headers: any

设置请求头

includeCredentials

includeCredentials: boolean

Private link

link: HTMLAnchorElement

method

请求的html方式 GET, POST

nameCallback

nameCallback: (name: string) => string

Type declaration

    • (name: string): string
    • Parameters

      • name: string

      Returns string

nativeFallbackOnError

nativeFallbackOnError: boolean

onProcess

onProcess: (event: ProgressEvent<EventTarget>) => any

下载进度事件回调

Type declaration

    • (event: ProgressEvent<EventTarget>): any
    • Parameters

      • event: ProgressEvent<EventTarget>

      Returns any

onloadstart

onloadstart: () => void

开始下载

Type declaration

    • (): void
    • Returns void

Private request

request: XMLHttpRequest

timeout

timeout: number

超时

url

url: string

下载地址

withCredentials

withCredentials: boolean

Methods

Private arrayBufferUTF8ToStr

  • arrayBufferUTF8ToStr(array: any): any
  • Parameters

    • array: any

    Returns any

Private clickLink

  • clickLink(): void
  • Returns void

Private createLink

  • createLink(): HTMLAnchorElement
  • Returns HTMLAnchorElement

Private createRequest

  • createRequest(): XMLHttpRequest
  • Returns XMLHttpRequest

Protected downloadFile

  • downloadFile(): Promise<unknown>
  • Returns Promise<unknown>

Private getContentType

  • getContentType(response: any): Promise<unknown>
  • Parameters

    • response: any

    Returns Promise<unknown>

Private getContentTypeFromFileSignature

  • getContentTypeFromFileSignature(file: any): Promise<unknown>
  • Parameters

    • file: any

    Returns Promise<unknown>

Private getContentTypeFromResponseHeader

  • getContentTypeFromResponseHeader(): string
  • Returns string

Private getFile

  • getFile(response: any, fileName: any): Promise<any>
  • Parameters

    • response: any
    • fileName: any

    Returns Promise<any>

Private getFileName

  • getFileName(): string
  • Returns string

Private initDownload

  • initDownload(resolve: any, reject: any): any
  • Parameters

    • resolve: any
    • reject: any

    Returns any

Private isMobile

  • isMobile(): boolean
  • Returns boolean

start

  • start(): Promise<unknown>
  • 开始下载

    Returns Promise<unknown>

    返回本组件实例

Private startDownload

  • startDownload(): Promise<any>
  • Returns Promise<any>

Generated using TypeDoc