Skip to content

Instantly share code, notes, and snippets.

@daimagine
daimagine / download-blob.js
Created April 15, 2019 06:12
Download file from API blob result
// 'download-blob.js', inspired by this gist:
// 'dreamyguy/downloadFile.js' https://gist.github.com/dreamyguy/6b4ab77d2f118adb8a63c4a03fba349d
// I added some handler to make it works in Chrome, Safari, and Firefox on iOS
const downloadBlob = (
result,
defaultFilename = 'content.dat',
mime = 'application/octet-stream'
) => {
if (window && result && result.data) {