version bump 0.14.0: removed FullPathDir

- CLI tool properly handles empty files
- node 9 added to travis
This commit is contained in:
SheetJS 2017-11-04 20:15:50 -04:00
parent 9e22a4425e
commit ec9ab57132
17 changed files with 50 additions and 70 deletions

View File

@ -1,5 +1,6 @@
language: node_js
node_js:
- "9"
- "8"
- "7"
- "6"
@ -7,7 +8,6 @@ node_js:
- "4"
- "0.12"
- "0.10"
- "0.9"
- "0.8"
before_install:
- "npm install -g npm@4.3.0"

10
CHANGELOG.md Normal file
View File

@ -0,0 +1,10 @@
# CHANGELOG
This log is intended to keep track of backwards-incompatible changes, including
but not limited to API changes and file location changes. Minor behavioral
changes may not be included if they are not expected to break existing code.
## 0.14.0 (2017-11-04)
* Completely removed `FullPathDir`

View File

@ -88,7 +88,7 @@ function mkdirp(path/*:string*/) { path.split("/").reduce(function(acc/*:string*
function write(path/*:string*/, data/*:CFBEntry*/) {
logit("write", fix_string(path));
fs.writeFileSync(path, /*::new Buffer((*/data.content/*:: :any))*/);
fs.writeFileSync(path, /*::new Buffer((*/data.content/*:: :any))*/ || new Buffer(0));
}
if(program.create || program.append) {

View File

@ -1 +1 @@
exports.version = '0.13.2';
exports.version = '0.14.0';

View File

@ -78,16 +78,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 = {};
var files/*:CFBFiles*/ = {}, Paths/*:Array<string>*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array<string>*/ = [];
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex);
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

View File

@ -1,5 +1,5 @@
/* [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>*/ = [];
@ -35,7 +35,6 @@ 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];
}
}

View File

@ -179,7 +179,7 @@ type CFBFiles = {[n:string]:CFBEntry};
/* [MS-CFB] v20130118 */
var CFB = (function _CFB(){
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
exports.version = '0.13.2';
exports.version = '0.14.0';
/* [MS-CFB] 2.6.4 */
function namecmp(l/*:string*/, r/*:string*/)/*:number*/ {
var L = l.split("/"), R = r.split("/");
@ -282,16 +282,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 = {};
var files/*:CFBFiles*/ = {}, Paths/*:Array<string>*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array<string>*/ = [];
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex);
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
@ -343,7 +342,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>*/ = [];
@ -379,7 +378,6 @@ 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];
}
}

12
cfb.js
View File

@ -161,7 +161,7 @@ function new_buf(sz) {
/* [MS-CFB] v20130118 */
var CFB = (function _CFB(){
var exports = {};
exports.version = '0.13.2';
exports.version = '0.14.0';
/* [MS-CFB] 2.6.4 */
function namecmp(l, r) {
var L = l.split("/"), R = r.split("/");
@ -264,16 +264,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 = {};
var files = {}, Paths = [], FileIndex = [], FullPaths = [];
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex);
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
@ -325,7 +324,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 = [];
@ -361,7 +360,6 @@ 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];
}
}

12
dist/cfb.js vendored
View File

@ -161,7 +161,7 @@ function new_buf(sz) {
/* [MS-CFB] v20130118 */
var CFB = (function _CFB(){
var exports = {};
exports.version = '0.13.2';
exports.version = '0.14.0';
/* [MS-CFB] 2.6.4 */
function namecmp(l, r) {
var L = l.split("/"), R = r.split("/");
@ -264,16 +264,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 = {};
var files = {}, Paths = [], FileIndex = [], FullPaths = [];
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex);
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
@ -325,7 +324,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 = [];
@ -361,7 +360,6 @@ 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];
}
}

2
dist/cfb.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/cfb.min.map vendored

File diff suppressed because one or more lines are too long

12
dist/xlscfb.js vendored
View File

@ -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 = '0.14.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 = {};
var files/*:CFBFiles*/ = {}, Paths/*:Array<string>*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array<string>*/ = [];
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex);
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,7 +237,6 @@ 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];
}
}

View File

@ -10,10 +10,6 @@ type CFBModule = {
utils:CFBUtils;
};
type CFBFullPathDir = {
[n:string]: CFBEntry;
}
type CFBUtils = any;
type ReadShiftFunc = {
@ -80,7 +76,6 @@ type CFBContainer = {
sectors:Array<any>;
};
FileIndex:CFBFileIndex;
FullPathDir:CFBFullPathDir;
FullPaths:Array<string>;
}

View File

@ -1,6 +1,6 @@
{
"name": "cfb",
"version": "0.13.2",
"version": "0.14.0",
"author": "sheetjs",
"description": "Compound File Binary File Format extractor",
"keywords": [ "cfb", "compression", "office" ],

11
types/index.d.ts vendored
View File

@ -74,22 +74,11 @@ export interface CFBEntry {
storage?: string;
}
/* cfb.FullPathDir Directory object */
export interface CFBDirectory {
/* cfb.FullPathDir keys are paths; cfb.Directory keys are file names */
[key: string]: CFBEntry;
}
/* File object */
export interface CFBContainer {
/* list of streams and storages */
FullPaths: string[];
/* Path -> CFB object mapping */
FullPathDir: CFBDirectory;
/* Array of entries in the same order as FullPaths */
FileIndex: CFBEntry[];

View File

@ -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 = '0.14.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 = {};
var files/*:CFBFiles*/ = {}, Paths/*:Array<string>*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array<string>*/ = [];
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex);
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,7 +237,6 @@ 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];
}
}

View File

@ -8,7 +8,7 @@ var DO_NOT_EXPORT_CFB = true;
/* [MS-CFB] v20130118 */
var CFB = (function _CFB(){
var exports = {};
exports.version = '0.13.2';
exports.version = '0.14.0';
/* [MS-CFB] 2.6.4 */
function namecmp(l, r) {
var L = l.split("/"), R = r.split("/");
@ -111,16 +111,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 = {};
var files = {}, Paths = [], FileIndex = [], FullPaths = [];
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex);
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
@ -172,7 +171,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 = [];
@ -208,7 +207,6 @@ 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];
}
}