Skip to content

IngressoRapidoWebComponents/ajax-blob-downloader

Repository files navigation

bower version open issues license

<ajax-blob-downloader>

Download blob from ajax request.

Demo and API docs

1) Add the downloader element.

<ajax-blob-downloader
  id="downloader"
  default-file-name="checklist.txt">
</ajax-blob-downloader>`

2) Add the ajax element that request and receive the blob content.

<iron-ajax
  id="downloadAjax"
  handle-as="blob"
  loading="{{_downloading}}"
  on-response="_onFileDownloaded"
  on-error="_onFileFailed">
</iron-ajax>

3) Send it to ajax-blob-downloader element from download method.

  _onFileDownloaded(e) {
    this.$.downloader.download(e.detail);
  }

4) Open the file! :)