version bump 0.4.2: using jszip module on node

- updated test_files
- new dependency in node: jszip
This commit is contained in:
SheetJS 2014-01-29 22:06:14 -05:00
parent 6990e66a56
commit 47dd984a6c
7 changed files with 19 additions and 7 deletions

@ -1 +1 @@
XLSX.version = '0.4.1';
XLSX.version = '0.4.2';

@ -1,6 +1,8 @@
function getdata(data) {
if(!data) return null;
if(data.data) return data.data;
if(data.asNodeBuffer && typeof Buffer !== 'undefined' && data.name.substr(-4)===".bin") return data.asNodeBuffer();
if(data.asBinary && data.name.substr(-4) !== ".bin") return data.asBinary();
if(data._data && data._data.getContent) {
/* TODO: something far more intelligent */
if(data.name.substr(-4) === ".bin") return Array.prototype.slice.call(data._data.getContent());
@ -20,6 +22,7 @@ var _fs, jszip;
if(typeof JSZip !== 'undefined') jszip = JSZip;
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
if(typeof Buffer !== 'undefined' && typeof jszip === 'undefined') jszip = require('jszip');
if(typeof jszip === 'undefined') jszip = require('./jszip').JSZip;
_fs = require('fs');
}

@ -2,7 +2,9 @@ function readSync(data, options) {
var zip, d = data;
var o = options||{};
switch((o.type||"base64")){
case "file": d = _fs.readFileSync(data).toString('base64');
case "file":
if(typeof Buffer !== 'undefined') { zip=new jszip(d=_fs.readFileSync(data)); break; }
d = _fs.readFileSync(data).toString('base64');
/* falls through */
case "base64": zip = new jszip(d, { base64:true }); break;
case "binary": zip = new jszip(d, { base64:false }); break;

@ -1,6 +1,6 @@
{
"name": "xlsx",
"version": "0.4.1",
"version": "0.4.2",
"author": "sheetjs",
"description": "XLSB / XLSX / XLSM parser",
"keywords": [ "xlsx", "xlsb", "xlsm", "office", "excel", "spreadsheet" ],
@ -9,8 +9,9 @@
},
"main": "./xlsx",
"dependencies": {
"ssf":">=0.1.1",
"ssf":">=0.5.5",
"codepage":"",
"jszip":"~0.2.1",
"commander":""
},
"devDependencies": {

@ -1,4 +1,5 @@
formula_stress_test.xlsb
time_stress_test_1.xlsb
LONumbers-2010.xlsx
LONumbers-2011.xlsx
LONumbers.xlsx

@ -1 +1 @@
Subproject commit 78b96314f232d09634beb8db7e65359434adc33a
Subproject commit 51eb4765cd8828155a72d5b2aa273e999daaa93e

@ -420,7 +420,7 @@ SSF.load_table = function(tbl) { for(var i=0; i!=0x0188; ++i) if(tbl[i]) SSF.loa
make_ssf(SSF);
var XLSX = {};
(function(XLSX){
XLSX.version = '0.4.1';
XLSX.version = '0.4.2';
var current_codepage, current_cptable, cptable;
if(typeof module !== "undefined" && typeof require !== 'undefined') {
if(typeof cptable === 'undefined') cptable = require('codepage');
@ -434,6 +434,8 @@ function _getchar(x) { return String.fromCharCode(x); }
function getdata(data) {
if(!data) return null;
if(data.data) return data.data;
if(data.asNodeBuffer && typeof Buffer !== 'undefined' && data.name.substr(-4)===".bin") return data.asNodeBuffer();
if(data.asBinary && data.name.substr(-4) !== ".bin") return data.asBinary();
if(data._data && data._data.getContent) {
/* TODO: something far more intelligent */
if(data.name.substr(-4) === ".bin") return Array.prototype.slice.call(data._data.getContent());
@ -453,6 +455,7 @@ var _fs, jszip;
if(typeof JSZip !== 'undefined') jszip = JSZip;
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
if(typeof Buffer !== 'undefined' && typeof jszip === 'undefined') jszip = require('jszip');
if(typeof jszip === 'undefined') jszip = require('./jszip').JSZip;
_fs = require('fs');
}
@ -2638,7 +2641,9 @@ function readSync(data, options) {
var zip, d = data;
var o = options||{};
switch((o.type||"base64")){
case "file": d = _fs.readFileSync(data).toString('base64');
case "file":
if(typeof Buffer !== 'undefined') { zip=new jszip(d=_fs.readFileSync(data)); break; }
d = _fs.readFileSync(data).toString('base64');
/* falls through */
case "base64": zip = new jszip(d, { base64:true }); break;
case "binary": zip = new jszip(d, { base64:false }); break;