Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "raw"

Index

Functions

Const downloadWithMime

  • downloadWithMime(name: string, src: string | TypedArray | ArrayBuffer | Blob, opts: Partial<DownloadOpts> & { mime: string }): void
  • Triggers download of given src blob (or typed array or string) as local file with filename name. MIME type option MUST be given. UTF-8 text encoding and URL expiry can be defined via the optional opts config object. See DownloadOpts for details & defaults. Use download if auto-detection of MIME type is required.

    remarks

    If src is not a blob already, it will be wrapped as such automatically. The mime option is only used for that wrapping purpose. The utf8 option is only used if src is a string and will trigger UTF-8 encoding of src.

    The function creates an object URL for download, which auto-expires again after expire millseconds (default: 10000) to free up memory. The URL won't be expired if expire <= 0.

    Parameters

    • name: string
    • src: string | TypedArray | ArrayBuffer | Blob
    • opts: Partial<DownloadOpts> & { mime: string }

    Returns void

Generated using TypeDoc