indentation
This commit is contained in:
parent
458ae0c70c
commit
081f62d099
1 changed files with 48 additions and 48 deletions
18
lib/xlsx.js
18
lib/xlsx.js
|
|
@ -3226,8 +3226,8 @@ function blobify(data) {
|
|||
if(Array.isArray(data)) return a2u(data);
|
||||
return data;
|
||||
}
|
||||
/* write or download file */
|
||||
function write_dl(fname, payload, enc) {
|
||||
/* write or download file */
|
||||
function write_dl(fname, payload, enc) {
|
||||
/*global IE_SaveFile, Blob, navigator, saveAs, document, File, chrome */
|
||||
if(typeof _fs !== 'undefined' && _fs.writeFileSync) return enc ? _fs.writeFileSync(fname, payload, enc) : _fs.writeFileSync(fname, payload);
|
||||
if(typeof Deno !== 'undefined') {
|
||||
|
|
@ -3241,21 +3241,21 @@ function write_dl(fname, payload, enc) {
|
|||
return Deno.writeFileSync(fname, payload);
|
||||
}
|
||||
var data = (enc == "utf8") ? utf8write(payload) : payload;
|
||||
if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname);
|
||||
if(typeof IE_SaveFile !== 'undefined') return IE_SaveFile(data, fname);
|
||||
if(typeof Blob !== 'undefined') {
|
||||
var blob = new Blob([blobify(data)], {type:"application/octet-stream"});
|
||||
if(typeof navigator !== 'undefined' && navigator.msSaveBlob) return navigator.msSaveBlob(blob, fname);
|
||||
if(typeof saveAs !== 'undefined') return saveAs(blob, fname);
|
||||
if(typeof navigator !== 'undefined' && navigator.msSaveBlob) return navigator.msSaveBlob(blob, fname);
|
||||
if(typeof saveAs !== 'undefined') return saveAs(blob, fname);
|
||||
if(typeof URL !== 'undefined' && typeof document !== 'undefined' && document.createElement && URL.createObjectURL) {
|
||||
var url = URL.createObjectURL(blob);
|
||||
if(typeof chrome === 'object' && typeof (chrome.downloads||{}).download == "function") {
|
||||
if(typeof chrome === 'object' && typeof (chrome.downloads||{}).download == "function") {
|
||||
if(URL.revokeObjectURL && typeof setTimeout !== 'undefined') setTimeout(function() { URL.revokeObjectURL(url); }, 60000);
|
||||
return chrome.downloads.download({ url: url, filename: fname, saveAs: true });
|
||||
}
|
||||
var a = document.createElement("a");
|
||||
if(a.download != null) {
|
||||
a.download = fname; a.href = url; document.body.appendChild(a); a.click();
|
||||
document.body.removeChild(a);
|
||||
a.download = fname; a.href = url; document.body.appendChild(a); a.click();
|
||||
document.body.removeChild(a);
|
||||
if(URL.revokeObjectURL && typeof setTimeout !== 'undefined') setTimeout(function() { URL.revokeObjectURL(url); }, 60000);
|
||||
return url;
|
||||
}
|
||||
|
|
@ -3273,7 +3273,7 @@ document.body.removeChild(a);
|
|||
out.write(payload); out.close(); return payload;
|
||||
} catch(e) { if(!e.message || e.message.indexOf("onstruct") == -1) throw e; }
|
||||
throw new Error("cannot save file " + fname);
|
||||
}
|
||||
}
|
||||
|
||||
/* read binary data from file */
|
||||
function read_binary(path) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue