1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Add exportAsFile optional type argument

This commit is contained in:
Whymarrh Whitby 2018-08-07 02:27:32 -02:30
parent 247fa2cc51
commit b83a746e4f

View File

@ -271,9 +271,9 @@ function getContractAtAddress (tokenAddress) {
return global.eth.contract(abi).at(tokenAddress)
}
function exportAsFile (filename, data) {
function exportAsFile (filename, data, type = 'text/csv') {
// source: https://stackoverflow.com/a/33542499 by Ludovic Feltz
const blob = new Blob([data], {type: 'text/csv'})
const blob = new Blob([data], {type})
if (window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveBlob(blob, filename)
} else {