ludc
2023-08-24 56c45e1f4be85d6bbfb3a03437021c6742b32ad9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
declare enum CFBEntryType { unknown, storage, stream, lockbytes, property, root }
declare enum CFBStorageType { fat, minifat }
 
/* CFB Entry Object demanded by write functions */
interface CFBEntryMin {
  
  /* Raw Content (Buffer when available, Array of bytes otherwise) */
  content:any;
}
 
/* CFB Entry Object returned by parse functions */
interface CFBEntry extends CFBEntryMin {
  
  /* Case-sensitive internal name */
  name:string;
  
  /* CFB type (salient types: stream, storage) -- see CFBEntryType */
  type:string;
  
  /* Creation Time */
  ct:Date;
  /* Modification Time */
  mt:Date;
 
 
  /* Raw creation time -- see [MS-DTYP] 2.3.3 FILETIME */
  mtime:string;
  /* Raw modification time -- see [MS-DTYP] 2.3.3 FILETIME */
  ctime:string;
 
  /* RBT color: 0 = red, 1 = black */
  color:number;
 
  /* Class ID represented as hex string */
  clsid:string;
 
  /* User-Defined State Bits */
  state:number;
 
  /* Starting Sector */
  start:number;
 
  /* Data Size */
  size:number;
  
  /* Storage location -- see CFBStorageType */
  storage:string;
}
 
 
/* cfb.FullPathDir as demanded by write functions */
interface CFBDirectoryMin {
 
  /* keys are unix-style paths */
  [key:string]: CFBEntryMin;
}
 
/* cfb.FullPathDir Directory object */
interface CFBDirectory extends CFBDirectoryMin {
 
  /* cfb.FullPathDir keys are paths; cfb.Directory keys are file names */
  [key:string]: CFBEntry;
}
 
 
/* cfb object demanded by write functions */
interface CFBContainerMin {
 
  /* Path -> CFB object mapping */
  FullPathDir:CFBDirectoryMin;
}
 
/* cfb object returned by read and parse functions */
interface CFBContainer extends CFBContainerMin {
 
  /* search by path or file name */
  find(string):CFBEntry;
 
  /* list of streams and storages */
  FullPaths:string[];
 
  /* Path -> CFB object mapping */
  FullPathDir:CFBDirectory;
 
  /* Array of entries in the same order as FullPaths */
  FileIndex:CFBEntry[];
 
  /* Raw Content, in chunks (Buffer when available, Array of bytes otherwise) */
  raw:any[];
}
 
 
interface CFB {
  read(f:any, options:any):CFBContainer;
  parse(f:any):CFBContainer;
  utils: {
    ReadShift(size:any,t?:any):any;
    WarnField(hexstr:string,fld?:string);
    CheckField(hexstr:string,fld?:string);
    prep_blob(blob:any, pos?:number):any;
    bconcat(bufs:any[]):any;
  };
  main;
}