forked from sheetjs/sheetjs
SheetJS
e1f8dbb863
- read BOM, handle UTF16LE-encoded XML - handle namespaces in [Content_Types].xml - parse workbook rels to determine sheet files - numbers OSX boolean support (apparently requires "0" or "1") - XLSX force "General" style to be serialized, omit implied cell type and style - updated SSF to 0.7.0 (h/t @sysarchitect) - updated jszip to 2.2.2 - removed old tests/files path, replaced with test_files - themes written - ignore potential existence of thumbnail when calculating relationship ids
20 lines
616 B
JavaScript
20 lines
616 B
JavaScript
function readSync(data, opts) {
|
|
var zip, d = data;
|
|
var o = opts||{};
|
|
if(!o.type) o.type = (typeof Buffer !== 'undefined' && data instanceof Buffer) ? "buffer" : "base64";
|
|
switch(o.type) {
|
|
case "base64": zip = new jszip(d, { base64:true }); break;
|
|
case "binary": zip = new jszip(d, { base64:false }); break;
|
|
case "buffer": zip = new jszip(d); break;
|
|
case "file": zip=new jszip(d=_fs.readFileSync(data)); break;
|
|
default: throw new Error("Unrecognized type " + o.type);
|
|
}
|
|
return parse_zip(zip, o);
|
|
}
|
|
|
|
function readFileSync(data, opts) {
|
|
var o = opts||{}; o.type = 'file';
|
|
return readSync(data, o);
|
|
}
|
|
|