downloadUrl
downloadUrlAs
  • Download a given URL to disk

    Normal URLs are downloaded normally. Data URLs are handled more carefully as it's not allowed in WebExt land to just call downloads.download() on them

    Parameters

    • url: string

      the URL to download

    • saveAs: boolean

      prompt user for a filename

    Returns Promise<void>

  • Dowload a given URL to disk

    This behaves mostly like downloadUrl, except that this function will use the native messenger in order to move the file to saveAs.

    Note: this requires a native messenger >=0.1.9. Make sure to nativegate for this.

    Parameters

    • url: string

      the URL to download

    • saveAs: string

      If beginning with a slash, this is the absolute path the document should be moved to. If the first character of the string is a tilda, it will be expanded to an absolute path to the user's home directory. If saveAs begins with any other character, it will be considered a path relative to where the native messenger binary is located (e.g. "$HOME/.local/share/tridactyl" on linux).

    • overwrite: boolean

      If true, overwrite the destination file, returns error code 1 otherwise if file exists

    • cleanup: boolean

      If true, cleans up temporary downloaded source file e.g. in $HOME/Downlods/downloaded.doc when the move operation fails e.g. due to target destination exists, OS error etc.

    Returns Promise<unknown>