~arx10/procustodibus-app

6773565ac6965e910fa2b1b72314669597455ed9 — Justin Ludwig a month ago 3b6cfe7
handle download of blob content
1 files changed, 4 insertions(+), 1 deletions(-)

M src/utils/download.js
M src/utils/download.js => src/utils/download.js +4 -1
@@ 16,7 16,10 @@ import { compareStrings, encodeBase64, quoteCsv } from '@/utils/text'
 */
function download(content, name, type) {
  const a = document.createElement('a')
  a.href = `data:${type || 'text/plain'};base64,${encodeBase64(content)}`
  a.href =
    type === 'blob'
      ? URL.createObjectURL(content)
      : `data:${type || 'text/plain'};base64,${encodeBase64(content)}`
  a.setAttribute('download', name)
  a.click()
}