xsheetjs/bits/87_read.js
SheetJS d4999ac421 version bump 0.7.8: docs, defaults, details
- browser shim updated (h/t @wintersm for discovering this)
- smart tag ignores (h/t @lostinplace)
- sheet_to_row_object_array bugfix (fixes #80, h/t @ChrisBurkeBSD)
- README improved
- baltic and vietnamese codepages: updated codepage to 1.3.4
- iOS Numbers can handle inline strings -> disabling SST by default
- avoid Buffer accessors (see https://github.com/joyent/node/issues/7809)
- caching certain hot regexes
2014-07-28 09:22:32 -04:00

20 lines
593 B
JavaScript

function readSync(data, opts) {
var zip, d = data;
var o = opts||{};
if(!o.type) o.type = (has_buf && Buffer.isBuffer(data)) ? "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);
}