File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1
1
var React = require ( 'react' ) ;
2
2
3
- module . exports = function ( data , filename ) {
4
- var blob = new Blob ( [ data ] , { type : 'text/csv '} ) ;
3
+ module . exports = function ( data , filename , mime ) {
4
+ var blob = new Blob ( [ data ] , { type : mime || 'application/octet-stream '} ) ;
5
5
if ( typeof window . navigator . msSaveBlob !== 'undefined' ) {
6
6
// IE workaround for "HTML7007: One or more blob URLs were
7
7
// revoked by closing the blob for which they were created.
@@ -10,9 +10,9 @@ module.exports = function(data, filename) {
10
10
window . navigator . msSaveBlob ( blob , filename ) ;
11
11
}
12
12
else {
13
- var csvURL = window . URL . createObjectURL ( blob ) ;
13
+ var blobURL = window . URL . createObjectURL ( blob ) ;
14
14
var tempLink = document . createElement ( 'a' ) ;
15
- tempLink . href = csvURL ;
15
+ tempLink . href = blobURL ;
16
16
tempLink . setAttribute ( 'download' , filename ) ;
17
17
tempLink . setAttribute ( 'target' , '_blank' ) ;
18
18
document . body . appendChild ( tempLink ) ;
You can’t perform that action at this time.
0 commit comments