2017-07-28 17:53:08 +00:00
|
|
|
/* index.d.ts (C) 2013-present SheetJS */
|
|
|
|
// TypeScript Version: 2.2
|
|
|
|
|
|
|
|
/** Version string */
|
|
|
|
export const version: string;
|
|
|
|
|
|
|
|
/** Parse a buffer or array */
|
2018-02-12 07:30:44 +00:00
|
|
|
export function parse(f: CFB$Blob, options?: CFB$ParsingOptions): CFB$Container;
|
2017-07-28 17:53:08 +00:00
|
|
|
|
|
|
|
/** Read a blob or file or binary string */
|
2018-02-12 07:30:44 +00:00
|
|
|
export function read(f: CFB$Blob | string, options?: CFB$ParsingOptions): CFB$Container;
|
2017-07-28 17:53:08 +00:00
|
|
|
|
2017-08-09 06:50:59 +00:00
|
|
|
/** Find a file entry given a path or file name */
|
2018-02-12 07:30:44 +00:00
|
|
|
export function find(cfb: CFB$Container, path: string): CFB$Entry | null;
|
2017-08-09 06:50:59 +00:00
|
|
|
|
2017-09-14 21:14:22 +00:00
|
|
|
/** Generate a container file */
|
2018-09-04 07:14:20 +00:00
|
|
|
export function write(cfb: CFB$Container, options?: CFB$WritingOptions): any;
|
2017-09-14 21:14:22 +00:00
|
|
|
|
|
|
|
/** Write a container file to the filesystem */
|
2018-09-04 07:14:20 +00:00
|
|
|
export function writeFile(cfb: CFB$Container, filename: string, options?: CFB$WritingOptions): any;
|
2017-09-14 21:14:22 +00:00
|
|
|
|
2017-07-28 17:53:08 +00:00
|
|
|
/** Utility functions */
|
|
|
|
export const utils: CFB$Utils;
|
|
|
|
|
2018-09-04 07:14:20 +00:00
|
|
|
export interface CFB$CommonOptions {
|
2020-07-09 06:12:05 +00:00
|
|
|
/** Data encoding */
|
2018-02-12 07:30:44 +00:00
|
|
|
type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array';
|
|
|
|
|
|
|
|
/** If true, throw errors when features are not understood */
|
|
|
|
WTF?: boolean;
|
2018-09-04 07:14:20 +00:00
|
|
|
}
|
2018-02-12 07:30:44 +00:00
|
|
|
|
2018-09-04 07:14:20 +00:00
|
|
|
/** Options for read and readFile */
|
|
|
|
export interface CFB$ParsingOptions extends CFB$CommonOptions {
|
2018-02-12 07:30:44 +00:00
|
|
|
/** If true, include raw data in output */
|
|
|
|
raw?: boolean;
|
2018-09-04 07:14:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Options for write and writeFile */
|
|
|
|
export interface CFB$WritingOptions extends CFB$CommonOptions {
|
|
|
|
/** Output file type */
|
2020-07-09 06:12:05 +00:00
|
|
|
fileType?: 'cfb' | 'zip' | 'mad';
|
2018-09-04 07:14:20 +00:00
|
|
|
|
|
|
|
/** Override default root entry name (CFB only) */
|
|
|
|
root?: string;
|
|
|
|
|
|
|
|
/** Enable compression (ZIP only) */
|
|
|
|
compression?: boolean;
|
2017-07-28 17:53:08 +00:00
|
|
|
}
|
|
|
|
|
2018-02-15 00:18:53 +00:00
|
|
|
export type CFB$Blob = number[] | Uint8Array;
|
2017-07-28 17:53:08 +00:00
|
|
|
|
2018-02-12 07:30:44 +00:00
|
|
|
export enum CFB$EntryType { unknown, storage, stream, lockbytes, property, root }
|
|
|
|
export enum CFB$StorageType { fat, minifat }
|
2017-07-28 17:53:08 +00:00
|
|
|
|
|
|
|
/** CFB File Entry Object */
|
2018-02-12 07:30:44 +00:00
|
|
|
export interface CFB$Entry {
|
|
|
|
/** Case-sensitive internal name */
|
|
|
|
name: string;
|
2017-07-28 17:53:08 +00:00
|
|
|
|
2018-02-12 07:30:44 +00:00
|
|
|
/** CFB type (salient types: stream, storage) -- see CFB$EntryType */
|
|
|
|
type: number;
|
2017-07-28 17:53:08 +00:00
|
|
|
|
2018-02-12 07:30:44 +00:00
|
|
|
/** Raw Content (Buffer when available, Array of bytes otherwise) */
|
|
|
|
content: CFB$Blob;
|
2017-07-28 17:53:08 +00:00
|
|
|
|
2018-02-12 07:30:44 +00:00
|
|
|
/** Creation Time */
|
|
|
|
ct?: Date;
|
2017-07-28 17:53:08 +00:00
|
|
|
|
2018-02-12 07:30:44 +00:00
|
|
|
/** Modification Time */
|
|
|
|
mt?: Date;
|
2017-07-28 17:53:08 +00:00
|
|
|
|
2018-02-12 07:30:44 +00:00
|
|
|
/** Red/Black Tree color: 0 = red, 1 = black */
|
|
|
|
color: number;
|
2017-07-28 17:53:08 +00:00
|
|
|
|
2018-02-12 07:30:44 +00:00
|
|
|
/** Class ID represented as hex string */
|
|
|
|
clsid: string;
|
2017-07-28 17:53:08 +00:00
|
|
|
|
2018-02-12 07:30:44 +00:00
|
|
|
/** User-Defined State Bits */
|
|
|
|
state: number;
|
2017-07-28 17:53:08 +00:00
|
|
|
|
2018-02-12 07:30:44 +00:00
|
|
|
/** Starting Sector */
|
|
|
|
start: number;
|
2017-07-28 17:53:08 +00:00
|
|
|
|
2018-02-12 07:30:44 +00:00
|
|
|
/** Data Size */
|
|
|
|
size: number;
|
2017-07-28 17:53:08 +00:00
|
|
|
|
2018-02-12 07:30:44 +00:00
|
|
|
/** Storage location -- see CFB$StorageType */
|
|
|
|
storage?: string;
|
2020-07-09 06:12:05 +00:00
|
|
|
|
|
|
|
/** Content Type (used for MAD) */
|
|
|
|
ctype?: string;
|
2017-07-28 17:53:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* File object */
|
2018-02-12 07:30:44 +00:00
|
|
|
export interface CFB$Container {
|
|
|
|
/* List of streams and storages */
|
|
|
|
FullPaths: string[];
|
|
|
|
|
|
|
|
/* Array of entries in the same order as FullPaths */
|
|
|
|
FileIndex: CFB$Entry[];
|
|
|
|
|
|
|
|
/* Raw Content, in chunks (Buffer when available, Array of bytes otherwise) */
|
|
|
|
raw?: {
|
|
|
|
header: CFB$Blob,
|
|
|
|
sectors: CFB$Blob[];
|
|
|
|
};
|
2017-07-28 17:53:08 +00:00
|
|
|
}
|
|
|
|
|
2018-04-09 06:33:22 +00:00
|
|
|
/** cfb_add options */
|
|
|
|
export interface CFB$AddOpts {
|
|
|
|
/** Skip existence and safety checks (best for bulk write operations) */
|
|
|
|
unsafe?: boolean;
|
|
|
|
}
|
|
|
|
|
2017-07-28 17:53:08 +00:00
|
|
|
/** General utilities */
|
|
|
|
export interface CFB$Utils {
|
2018-02-12 07:30:44 +00:00
|
|
|
cfb_new(opts?: any): CFB$Container;
|
2018-04-09 06:33:22 +00:00
|
|
|
cfb_add(cfb: CFB$Container, name: string, content: any, opts?: CFB$AddOpts): CFB$Entry;
|
2018-02-12 07:30:44 +00:00
|
|
|
cfb_del(cfb: CFB$Container, name: string): boolean;
|
|
|
|
cfb_mov(cfb: CFB$Container, old_name: string, new_name: string): boolean;
|
|
|
|
cfb_gc(cfb: CFB$Container): void;
|
|
|
|
ReadShift(size: number, t?: string): number|string;
|
|
|
|
WarnField(hexstr: string, fld?: string): void;
|
|
|
|
CheckField(hexstr: string, fld?: string): void;
|
|
|
|
prep_blob(blob: any, pos?: number): CFB$Blob;
|
|
|
|
bconcat(bufs: any[]): any;
|
2017-07-28 17:53:08 +00:00
|
|
|
}
|