version bump 0.11.8: CFB 1.0.0

- travis node 9 test
- demo refresh
This commit is contained in:
SheetJS 2017-11-05 14:18:35 -05:00
parent 1ab13069cb
commit 3f6f8e93ed
29 changed files with 217 additions and 128 deletions

@ -31,6 +31,7 @@ tmp
*.exe
*.img
.gitignore
.gitattributes
.fossaignore
.spelling
.eslintrc

@ -1,5 +1,6 @@
language: node_js
node_js:
- "9"
- "8"
- "7"
- "6"
@ -9,16 +10,18 @@ matrix:
env: TZ="America/New_York" FMTS=misc
- node_js: "8"
env: TZ="America/Los_Angeles"
- node_js: "6"
env: TZ="Europe/London" FMTS=misc
- node_js: "8"
env: TZ="Europe/London" FMTS=misc
- node_js: "6"
env: TZ="Europe/Berlin"
- node_js: "6"
env: TZ="Asia/Kolkata" FMTS=misc
- node_js: "7"
- node_js: "9"
env: TZ="Asia/Shanghai"
- node_js: "8"
env: TZ="Asia/Seoul" FMTS=misc
- node_js: "7"
env: TZ="America/Cancun" FMTS=misc
- node_js: "5"
env: TZ="America/Anchorage" FMTS=misc

@ -188,7 +188,7 @@ The [`demos` directory](demos/) includes sample projects for:
**Frameworks and APIs**
- [`angular 1.x`](demos/angular/)
- [`angular 2.x / 4.x`](demos/angular2/)
- [`angular 2.x / 4.x / 5.x`](demos/angular2/)
- [`meteor`](demos/meteor/)
- [`react and react-native`](demos/react/)
- [`vue 2.x and weex`](demos/vue/)

@ -1 +1 @@
XLSX.version = '0.11.7';
XLSX.version = '0.11.8';

@ -38,7 +38,7 @@ type CFBFiles = {[n:string]:CFBEntry};
/* [MS-CFB] v20130118 */
var CFB = (function _CFB(){
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
exports.version = '0.13.2';
exports.version = '1.0.0';
/* [MS-CFB] 2.6.4 */
function namecmp(l/*:string*/, r/*:string*/)/*:number*/ {
var L = l.split("/"), R = r.split("/");
@ -141,16 +141,15 @@ sector_list.fat_addrs = fat_addrs;
sector_list.ssz = ssz;
/* [MS-CFB] 2.6.1 Compound File Directory Entry */
var files/*:CFBFiles*/ = {}, Paths/*:Array<string>*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array<string>*/ = [], FullPathDir = {};
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex);
var files/*:CFBFiles*/ = {}, Paths/*:Array<string>*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array<string>*/ = [];
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, minifat_start);
build_full_paths(FileIndex, FullPathDir, FullPaths, Paths);
build_full_paths(FileIndex, FullPaths, Paths);
Paths.shift();
var o = {
FileIndex: FileIndex,
FullPaths: FullPaths,
FullPathDir: FullPathDir
FullPaths: FullPaths
};
// $FlowIgnore
@ -202,7 +201,7 @@ function sectorify(file/*:RawBytes*/, ssz/*:number*/)/*:Array<RawBytes>*/ {
}
/* [MS-CFB] 2.6.4 Red-Black Tree */
function build_full_paths(FI/*:CFBFileIndex*/, FPD/*:CFBFullPathDir*/, FP/*:Array<string>*/, Paths/*:Array<string>*/)/*:void*/ {
function build_full_paths(FI/*:CFBFileIndex*/, FP/*:Array<string>*/, Paths/*:Array<string>*/)/*:void*/ {
var i = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length;
var dad/*:Array<number>*/ = [], q/*:Array<number>*/ = [];
@ -238,10 +237,23 @@ function build_full_paths(FI/*:CFBFileIndex*/, FPD/*:CFBFullPathDir*/, FP/*:Arra
FP[0] += "/";
for(i=1; i < pl; ++i) {
if(FI[i].type !== 2 /* stream */) FP[i] += "/";
FPD[FP[i]] = FI[i];
}
}
function get_mfat_entry(entry/*:CFBEntry*/, payload/*:RawBytes*/, mini/*:?RawBytes*/)/*:CFBlob*/ {
var start = entry.start, size = entry.size;
//return (payload.slice(start*MSSZ, start*MSSZ + size)/*:any*/);
var o = [];
var idx = start;
while(mini && size > 0 && idx >= 0) {
o.push(payload.slice(idx * MSSZ, idx * MSSZ + MSSZ));
size -= MSSZ;
idx = __readInt32LE(mini, idx * 4);
}
if(o.length === 0) return (new_buf(0)/*:any*/);
return (bconcat(o).slice(0, entry.size)/*:any*/);
}
/** Chase down the rest of the DIFAT chain to build a comprehensive list
DIFAT chains by storing the next sector number as the last 32 bits */
function sleuth_fat(idx/*:number*/, cnt/*:number*/, sectors/*:Array<RawBytes>*/, ssz/*:number*/, fat_addrs)/*:void*/ {
@ -303,7 +315,7 @@ function make_sector_list(sectors/*:Array<RawBytes>*/, dir_start/*:number*/, fat
}
/* [MS-CFB] 2.6.1 Compound File Directory Entry */
function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sectors/*:Array<RawBytes>*/, Paths/*:Array<string>*/, nmfs, files, FileIndex) {
function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sectors/*:Array<RawBytes>*/, Paths/*:Array<string>*/, nmfs, files, FileIndex, mini) {
var minifat_store = 0, pl = (Paths.length?2:0);
var sector = sector_list[dir_start].data;
var i = 0, namelen = 0, name;
@ -345,7 +357,7 @@ function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sector
} else {
o.storage = 'minifat';
if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) {
o.content = (sector_list[minifat_store].data.slice(o.start*MSSZ,o.start*MSSZ+o.size)/*:any*/);
o.content = get_mfat_entry(o, sector_list[minifat_store].data, (sector_list[mini]||{}).data);
prep_blob(o.content, 0);
}
}

@ -19,7 +19,7 @@ can be installed with Bash on Windows or with `cygwin`.
**Frameworks and APIs**
- [`angular 1.x`](angular/)
- [`angular 2.x / 4.x`](angular2/)
- [`angular 2.x / 4.x / 5.x`](angular2/)
- [`meteor`](meteor/)
- [`react and react-native`](react/)
- [`vue 2.x and weex`](vue/)

@ -14,3 +14,10 @@ angular:
if [ ! -e node_modules/xlsx ]; then cd node_modules; ln -s ../../../ xlsx; cd -; fi
ng build
# Test Angular5 build
cp package.json-angular5 package.json
npm install
if [ ! -e node_modules ]; then mkdir node_modules; fi
if [ ! -e node_modules/xlsx ]; then cd node_modules; ln -s ../../../ xlsx; cd -; fi
ng build

@ -67,27 +67,20 @@ saveAs(new Blob([s2ab(wbout)]), 'SheetJS.xlsx');
## Switching between Angular versions
Modules that work with Angular 2 largely work as-is with Angular 4. Switching
Modules that work with Angular 2 largely work as-is with Angular 4+. Switching
between versions is mostly a matter of installing the correct version of the
core and associated modules. This demo includes a `package.json` for Angular 2
and another `package.json` for Angular 4.
core and associated modules. This demo includes `package.json-angular#` files
for Angular 2, Angular 4, and Angular 5
Switching to Angular 2 is as simple as:
To test a particular Angular version, overwrite `package.json`:
```bash
# switch to Angular 2
$ cp package.json-angular2 package.json
$ npm install
$ ng serve
```
Switching to Angular 4 is as simple as:
```bash
$ cp package.json-angular4 package.json
$ npm install
$ ng serve
```
## XLSX Symbolic Link
In this tree, `node_modules/xlsx` is a link pointing back to the root. This

@ -1,5 +1,5 @@
{
"name": "angular2",
"name": "angular5",
"version": "0.0.0",
"license": "MIT",
"scripts": {
@ -9,27 +9,31 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14",
"file-saver": "^1.3.3"
},
"devDependencies": {
"@angular/cli": "1.1.2",
"@angular/compiler-cli": "^4.0.0",
"@angular/language-service": "^4.0.0",
"@angular/cli": "1.5.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@types/node": "~6.0.60",
"ts-node": "~3.0.4",
"tslint": "~5.3.2",
"typescript": "~2.3.3"
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
}
}

@ -1,5 +1,5 @@
{
"name": "angular2",
"name": "angular4",
"version": "0.0.0",
"license": "MIT",
"scripts": {

@ -0,0 +1,39 @@
{
"name": "angular5",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14",
"file-saver": "^1.3.3"
},
"devDependencies": {
"@angular/cli": "1.5.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@types/node": "~6.0.60",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
}
}

@ -10,7 +10,7 @@ into web pages with script tags:
The library can also be imported directly from JSX code with:
```js
import * as XLSX from 'xlsx';
import XLSX from 'xlsx';
```
This demo shows a simple JSX component transpiled in the browser using the babel

@ -1,3 +1,3 @@
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
import * as XLSX from 'xlsx';
import XLSX from 'xlsx';
import { saveAs } from 'file-saver';

@ -1,5 +1,5 @@
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
import * as XLSX from 'xlsx';
import XLSX from 'xlsx';
import React, { Component } from 'react';
import { AppRegistry, StyleSheet, Text, View, Button, Alert, Image } from 'react-native';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

26
dist/xlsx.full.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

36
dist/xlsx.js vendored

@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false */
var XLSX = {};
(function make_xlsx(XLSX){
XLSX.version = '0.11.7';
XLSX.version = '0.11.8';
var current_codepage = 1200;
/*global cptable:true */
if(typeof module !== "undefined" && typeof require !== 'undefined') {
@ -1026,7 +1026,7 @@ var DO_NOT_EXPORT_CFB = true;
/* [MS-CFB] v20130118 */
var CFB = (function _CFB(){
var exports = {};
exports.version = '0.13.2';
exports.version = '1.0.0';
/* [MS-CFB] 2.6.4 */
function namecmp(l, r) {
var L = l.split("/"), R = r.split("/");
@ -1129,16 +1129,15 @@ sector_list.fat_addrs = fat_addrs;
sector_list.ssz = ssz;
/* [MS-CFB] 2.6.1 Compound File Directory Entry */
var files = {}, Paths = [], FileIndex = [], FullPaths = [], FullPathDir = {};
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex);
var files = {}, Paths = [], FileIndex = [], FullPaths = [];
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, minifat_start);
build_full_paths(FileIndex, FullPathDir, FullPaths, Paths);
build_full_paths(FileIndex, FullPaths, Paths);
Paths.shift();
var o = {
FileIndex: FileIndex,
FullPaths: FullPaths,
FullPathDir: FullPathDir
FullPaths: FullPaths
};
// $FlowIgnore
@ -1190,7 +1189,7 @@ function sectorify(file, ssz) {
}
/* [MS-CFB] 2.6.4 Red-Black Tree */
function build_full_paths(FI, FPD, FP, Paths) {
function build_full_paths(FI, FP, Paths) {
var i = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length;
var dad = [], q = [];
@ -1226,10 +1225,23 @@ function build_full_paths(FI, FPD, FP, Paths) {
FP[0] += "/";
for(i=1; i < pl; ++i) {
if(FI[i].type !== 2 /* stream */) FP[i] += "/";
FPD[FP[i]] = FI[i];
}
}
function get_mfat_entry(entry, payload, mini) {
var start = entry.start, size = entry.size;
//return (payload.slice(start*MSSZ, start*MSSZ + size));
var o = [];
var idx = start;
while(mini && size > 0 && idx >= 0) {
o.push(payload.slice(idx * MSSZ, idx * MSSZ + MSSZ));
size -= MSSZ;
idx = __readInt32LE(mini, idx * 4);
}
if(o.length === 0) return (new_buf(0));
return (bconcat(o).slice(0, entry.size));
}
/** Chase down the rest of the DIFAT chain to build a comprehensive list
DIFAT chains by storing the next sector number as the last 32 bits */
function sleuth_fat(idx, cnt, sectors, ssz, fat_addrs) {
@ -1291,7 +1303,7 @@ function make_sector_list(sectors, dir_start, fat_addrs, ssz) {
}
/* [MS-CFB] 2.6.1 Compound File Directory Entry */
function read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex) {
function read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, mini) {
var minifat_store = 0, pl = (Paths.length?2:0);
var sector = sector_list[dir_start].data;
var i = 0, namelen = 0, name;
@ -1333,7 +1345,7 @@ function read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, Fil
} else {
o.storage = 'minifat';
if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) {
o.content = (sector_list[minifat_store].data.slice(o.start*MSSZ,o.start*MSSZ+o.size));
o.content = get_mfat_entry(o, sector_list[minifat_store].data, (sector_list[mini]||{}).data);
prep_blob(o.content, 0);
}
}
@ -2102,7 +2114,7 @@ var matchtag = (function() {
})();
function htmldecode(str) {
return str.trim().replace(/\s+/g, " ").replace(/<\s*[bB][rR]\s*\/?/g,"\n").replace(/<[^>]*>/g,"").replace(/&nbsp;/g, " ");
return str.trim().replace(/\s+/g, " ").replace(/<\s*[bB][rR]\s*\/?>/g,"\n").replace(/<[^>]*>/g,"").replace(/&nbsp;/g, " ");
}
var vtregex = (function(){ var vt_cache = {};

24
dist/xlsx.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/xlsx.min.map vendored

File diff suppressed because one or more lines are too long

@ -4,7 +4,7 @@ The [`demos` directory](demos/) includes sample projects for:
**Frameworks and APIs**
- [`angular 1.x`](demos/angular/)
- [`angular 2.x / 4.x`](demos/angular2/)
- [`angular 2.x / 4.x / 5.x`](demos/angular2/)
- [`meteor`](demos/meteor/)
- [`react and react-native`](demos/react/)
- [`vue 2.x and weex`](demos/vue/)

@ -179,7 +179,7 @@ The [`demos` directory](demos/) includes sample projects for:
**Frameworks and APIs**
- [`angular 1.x`](demos/angular/)
- [`angular 2.x / 4.x`](demos/angular2/)
- [`angular 2.x / 4.x / 5.x`](demos/angular2/)
- [`meteor`](demos/meteor/)
- [`react and react-native`](demos/react/)
- [`vue 2.x and weex`](demos/vue/)

@ -55,10 +55,6 @@ type CFBModule = {
utils:CFBUtils;
};
type CFBFullPathDir = {
[n:string]: CFBEntry;
}
type CFBUtils = any;
type CheckFieldFunc = {(hexstr:string, fld:string):void;};
@ -114,7 +110,6 @@ type CFBContainer = {
sectors:Array<any>;
};
FileIndex:CFBFileIndex;
FullPathDir:CFBFullPathDir;
FullPaths:Array<string>;
}

@ -1,6 +1,6 @@
{
"name": "xlsx",
"version": "0.11.7",
"version": "0.11.8",
"author": "sheetjs",
"description": "SheetJS Spreadsheet data parser and writer",
"keywords": [ "excel", "xls", "xlsx", "xlsb", "xlsm", "ods", "csv", "dbf", "dif", "sylk", "office", "spreadsheet" ],
@ -20,7 +20,7 @@
"exit-on-epipe": "~1.0.1",
"ssf": "~0.10.1",
"codepage": "~1.11.0",
"cfb": "~0.13.2",
"cfb": "~1.0.0",
"crc-32": "~1.1.1",
"adler-32": "~1.1.0",
"commander": "~2.11.0"

@ -1863,7 +1863,7 @@ describe('HTML', function() {
it('should generate strings if raw option is passed', function() { plaintext_test(X.utils.table_to_book(get_dom_element(html_str), {raw:true}), true, true); });
it('should handle newlines correctly', function() {
var table = get_dom_element("<table><tr><td>foo<br/>bar</td><td>baz</td></tr></table>");
var wb = X.utils.table_to_book(table)
var wb = X.utils.table_to_book(table);
assert.equal(get_cell(wb.Sheets.Sheet1, "A1").v, "foo\nbar");
});
});

@ -1862,9 +1862,8 @@ describe('HTML', function() {
it('should interpret values by default', function() { plaintext_test(X.utils.table_to_book(get_dom_element(html_str)), false, true); });
it('should generate strings if raw option is passed', function() { plaintext_test(X.utils.table_to_book(get_dom_element(html_str), {raw:true}), true, true); });
it('should handle newlines correctly', function() {
var table = document.createElement('table');
table.innerHTML = "<tr><td>foo<br/>bar</td><td>baz</td></tr>";
var wb = X.utils.table_to_book(table)
var table = get_dom_element("<table><tr><td>foo<br/>bar</td><td>baz</td></tr></table>");
var wb = X.utils.table_to_book(table);
assert.equal(get_cell(wb.Sheets.Sheet1, "A1").v, "foo\nbar");
});
});

@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false */
var XLSX = {};
(function make_xlsx(XLSX){
XLSX.version = '0.11.7';
XLSX.version = '0.11.8';
var current_codepage = 1200;
/*:: declare var cptable:any; */
/*global cptable:true */
@ -1089,7 +1089,7 @@ type CFBFiles = {[n:string]:CFBEntry};
/* [MS-CFB] v20130118 */
var CFB = (function _CFB(){
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
exports.version = '0.13.2';
exports.version = '1.0.0';
/* [MS-CFB] 2.6.4 */
function namecmp(l/*:string*/, r/*:string*/)/*:number*/ {
var L = l.split("/"), R = r.split("/");
@ -1192,16 +1192,15 @@ sector_list.fat_addrs = fat_addrs;
sector_list.ssz = ssz;
/* [MS-CFB] 2.6.1 Compound File Directory Entry */
var files/*:CFBFiles*/ = {}, Paths/*:Array<string>*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array<string>*/ = [], FullPathDir = {};
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex);
var files/*:CFBFiles*/ = {}, Paths/*:Array<string>*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array<string>*/ = [];
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, minifat_start);
build_full_paths(FileIndex, FullPathDir, FullPaths, Paths);
build_full_paths(FileIndex, FullPaths, Paths);
Paths.shift();
var o = {
FileIndex: FileIndex,
FullPaths: FullPaths,
FullPathDir: FullPathDir
FullPaths: FullPaths
};
// $FlowIgnore
@ -1253,7 +1252,7 @@ function sectorify(file/*:RawBytes*/, ssz/*:number*/)/*:Array<RawBytes>*/ {
}
/* [MS-CFB] 2.6.4 Red-Black Tree */
function build_full_paths(FI/*:CFBFileIndex*/, FPD/*:CFBFullPathDir*/, FP/*:Array<string>*/, Paths/*:Array<string>*/)/*:void*/ {
function build_full_paths(FI/*:CFBFileIndex*/, FP/*:Array<string>*/, Paths/*:Array<string>*/)/*:void*/ {
var i = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length;
var dad/*:Array<number>*/ = [], q/*:Array<number>*/ = [];
@ -1289,10 +1288,23 @@ function build_full_paths(FI/*:CFBFileIndex*/, FPD/*:CFBFullPathDir*/, FP/*:Arra
FP[0] += "/";
for(i=1; i < pl; ++i) {
if(FI[i].type !== 2 /* stream */) FP[i] += "/";
FPD[FP[i]] = FI[i];
}
}
function get_mfat_entry(entry/*:CFBEntry*/, payload/*:RawBytes*/, mini/*:?RawBytes*/)/*:CFBlob*/ {
var start = entry.start, size = entry.size;
//return (payload.slice(start*MSSZ, start*MSSZ + size)/*:any*/);
var o = [];
var idx = start;
while(mini && size > 0 && idx >= 0) {
o.push(payload.slice(idx * MSSZ, idx * MSSZ + MSSZ));
size -= MSSZ;
idx = __readInt32LE(mini, idx * 4);
}
if(o.length === 0) return (new_buf(0)/*:any*/);
return (bconcat(o).slice(0, entry.size)/*:any*/);
}
/** Chase down the rest of the DIFAT chain to build a comprehensive list
DIFAT chains by storing the next sector number as the last 32 bits */
function sleuth_fat(idx/*:number*/, cnt/*:number*/, sectors/*:Array<RawBytes>*/, ssz/*:number*/, fat_addrs)/*:void*/ {
@ -1354,7 +1366,7 @@ function make_sector_list(sectors/*:Array<RawBytes>*/, dir_start/*:number*/, fat
}
/* [MS-CFB] 2.6.1 Compound File Directory Entry */
function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sectors/*:Array<RawBytes>*/, Paths/*:Array<string>*/, nmfs, files, FileIndex) {
function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sectors/*:Array<RawBytes>*/, Paths/*:Array<string>*/, nmfs, files, FileIndex, mini) {
var minifat_store = 0, pl = (Paths.length?2:0);
var sector = sector_list[dir_start].data;
var i = 0, namelen = 0, name;
@ -1396,7 +1408,7 @@ function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sector
} else {
o.storage = 'minifat';
if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) {
o.content = (sector_list[minifat_store].data.slice(o.start*MSSZ,o.start*MSSZ+o.size)/*:any*/);
o.content = get_mfat_entry(o, sector_list[minifat_store].data, (sector_list[mini]||{}).data);
prep_blob(o.content, 0);
}
}

34
xlsx.js

@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false */
var XLSX = {};
(function make_xlsx(XLSX){
XLSX.version = '0.11.7';
XLSX.version = '0.11.8';
var current_codepage = 1200;
/*global cptable:true */
if(typeof module !== "undefined" && typeof require !== 'undefined') {
@ -1026,7 +1026,7 @@ var DO_NOT_EXPORT_CFB = true;
/* [MS-CFB] v20130118 */
var CFB = (function _CFB(){
var exports = {};
exports.version = '0.13.2';
exports.version = '1.0.0';
/* [MS-CFB] 2.6.4 */
function namecmp(l, r) {
var L = l.split("/"), R = r.split("/");
@ -1129,16 +1129,15 @@ sector_list.fat_addrs = fat_addrs;
sector_list.ssz = ssz;
/* [MS-CFB] 2.6.1 Compound File Directory Entry */
var files = {}, Paths = [], FileIndex = [], FullPaths = [], FullPathDir = {};
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex);
var files = {}, Paths = [], FileIndex = [], FullPaths = [];
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, minifat_start);
build_full_paths(FileIndex, FullPathDir, FullPaths, Paths);
build_full_paths(FileIndex, FullPaths, Paths);
Paths.shift();
var o = {
FileIndex: FileIndex,
FullPaths: FullPaths,
FullPathDir: FullPathDir
FullPaths: FullPaths
};
// $FlowIgnore
@ -1190,7 +1189,7 @@ function sectorify(file, ssz) {
}
/* [MS-CFB] 2.6.4 Red-Black Tree */
function build_full_paths(FI, FPD, FP, Paths) {
function build_full_paths(FI, FP, Paths) {
var i = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length;
var dad = [], q = [];
@ -1226,10 +1225,23 @@ function build_full_paths(FI, FPD, FP, Paths) {
FP[0] += "/";
for(i=1; i < pl; ++i) {
if(FI[i].type !== 2 /* stream */) FP[i] += "/";
FPD[FP[i]] = FI[i];
}
}
function get_mfat_entry(entry, payload, mini) {
var start = entry.start, size = entry.size;
//return (payload.slice(start*MSSZ, start*MSSZ + size));
var o = [];
var idx = start;
while(mini && size > 0 && idx >= 0) {
o.push(payload.slice(idx * MSSZ, idx * MSSZ + MSSZ));
size -= MSSZ;
idx = __readInt32LE(mini, idx * 4);
}
if(o.length === 0) return (new_buf(0));
return (bconcat(o).slice(0, entry.size));
}
/** Chase down the rest of the DIFAT chain to build a comprehensive list
DIFAT chains by storing the next sector number as the last 32 bits */
function sleuth_fat(idx, cnt, sectors, ssz, fat_addrs) {
@ -1291,7 +1303,7 @@ function make_sector_list(sectors, dir_start, fat_addrs, ssz) {
}
/* [MS-CFB] 2.6.1 Compound File Directory Entry */
function read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex) {
function read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, mini) {
var minifat_store = 0, pl = (Paths.length?2:0);
var sector = sector_list[dir_start].data;
var i = 0, namelen = 0, name;
@ -1333,7 +1345,7 @@ function read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, Fil
} else {
o.storage = 'minifat';
if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) {
o.content = (sector_list[minifat_store].data.slice(o.start*MSSZ,o.start*MSSZ+o.size));
o.content = get_mfat_entry(o, sector_list[minifat_store].data, (sector_list[mini]||{}).data);
prep_blob(o.content, 0);
}
}