react-file-download
Advanced tools
Comparing version
var React = require('react'); | ||
module.exports = function(data, filename) { | ||
var data = new Blob([data], {type: 'text/csv'}); | ||
var csvURL = window.URL.createObjectURL(data); | ||
var blob = new Blob([data], {type: 'text/csv'}); | ||
if (typeof window.navigator.msSaveBlob !== 'undefined') { | ||
// IE workaround for "HTML7007: One or more blob URLs were revoked by closing the blob for which they were created. These URLs will no longer resolve as the data backing the URL has been freed." | ||
window.navigator.msSaveBlob(blob, filename); | ||
} else { | ||
var csvURL = window.URL.createObjectURL(blob); | ||
var tempLink = document.createElement('a'); | ||
@@ -11,1 +15,2 @@ tempLink.href = csvURL; | ||
} | ||
} |
{ | ||
"name": "react-file-download", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "React component that trigger browser to save javascript-generated content to a file", | ||
@@ -17,3 +17,6 @@ "main": "file-download.js", | ||
"keywords": [ | ||
"react-components" | ||
"react-components", | ||
"react", | ||
"file", | ||
"download" | ||
], | ||
@@ -20,0 +23,0 @@ "author": "Kenneth Jiang <kenneth.jiang@gmail.com>", |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3126
101.03%7
16.67%14
55.56%0
-100%34
Infinity%0
-100%