MyCrypto/common/utils/blob.js

10 lines
263 B
JavaScript
Raw Normal View History

// @flow
export function makeBlob(mime: string, str: string | Object) {
str = typeof str === 'object' ? JSON.stringify(str) : str;
if (str === null) return '';
const blob = new Blob([str], {
type: mime
});
return window.URL.createObjectURL(blob);
}