pst-extractor 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/ColumnDescriptor.class.d.ts +26 -26
  2. package/dist/ColumnDescriptor.class.js +51 -51
  3. package/dist/DescriptorIndexNode.class.d.ts +25 -26
  4. package/dist/DescriptorIndexNode.class.js +53 -53
  5. package/dist/LZFu.class.d.ts +11 -12
  6. package/dist/LZFu.class.js +95 -95
  7. package/dist/NodeInfo.class.d.ts +33 -33
  8. package/dist/NodeInfo.class.js +52 -52
  9. package/dist/NodeMap.class.d.ts +35 -35
  10. package/dist/NodeMap.class.js +86 -86
  11. package/dist/OffsetIndexItem.class.d.ts +23 -24
  12. package/dist/OffsetIndexItem.class.js +45 -45
  13. package/dist/OutlookProperties.d.ts +275 -275
  14. package/dist/OutlookProperties.js +281 -281
  15. package/dist/PSTActivity.class.d.ts +103 -103
  16. package/dist/PSTActivity.class.js +144 -144
  17. package/dist/PSTAppointment.class.d.ts +270 -271
  18. package/dist/PSTAppointment.class.js +376 -376
  19. package/dist/PSTAttachment.class.d.ts +172 -172
  20. package/dist/PSTAttachment.class.js +317 -317
  21. package/dist/PSTContact.class.d.ts +884 -884
  22. package/dist/PSTContact.class.js +1227 -1227
  23. package/dist/PSTDescriptorItem.class.d.ts +45 -46
  24. package/dist/PSTDescriptorItem.class.js +99 -99
  25. package/dist/PSTFile.class.d.ts +215 -216
  26. package/dist/PSTFile.class.js +818 -818
  27. package/dist/PSTFolder.class.d.ts +129 -129
  28. package/dist/PSTFolder.class.js +318 -310
  29. package/dist/PSTMessage.class.d.ts +788 -789
  30. package/dist/PSTMessage.class.js +1321 -1321
  31. package/dist/PSTMessageStore.class.d.ts +13 -13
  32. package/dist/PSTMessageStore.class.js +17 -17
  33. package/dist/PSTNodeInputStream.class.d.ts +122 -123
  34. package/dist/PSTNodeInputStream.class.js +514 -514
  35. package/dist/PSTObject.class.d.ts +133 -134
  36. package/dist/PSTObject.class.js +326 -326
  37. package/dist/PSTRecipient.class.d.ts +65 -65
  38. package/dist/PSTRecipient.class.js +103 -103
  39. package/dist/PSTTable.class.d.ts +52 -52
  40. package/dist/PSTTable.class.js +175 -175
  41. package/dist/PSTTable7C.class.d.ts +45 -45
  42. package/dist/PSTTable7C.class.js +281 -281
  43. package/dist/PSTTableBC.class.d.ts +31 -31
  44. package/dist/PSTTableBC.class.js +111 -111
  45. package/dist/PSTTableItem.class.d.ts +47 -48
  46. package/dist/PSTTableItem.class.js +124 -124
  47. package/dist/PSTTask.class.d.ts +146 -146
  48. package/dist/PSTTask.class.js +205 -205
  49. package/dist/PSTUtil.class.d.ts +134 -135
  50. package/dist/PSTUtil.class.js +795 -795
  51. package/dist/RecurrencePattern.class.d.ts +49 -50
  52. package/dist/RecurrencePattern.class.js +120 -120
  53. package/dist/index.d.ts +6 -6
  54. package/dist/index.js +15 -15
  55. package/example/package.json +6 -6
  56. package/example/yarn.lock +95 -44
  57. package/junit.xml +68 -68
  58. package/package.json +26 -26
  59. package/readme.md +1 -3
@@ -1,26 +1,26 @@
1
- import { NodeInfo } from './NodeInfo.class';
2
- export declare class ColumnDescriptor {
3
- private _ibData;
4
- get ibData(): number;
5
- private _cbData;
6
- get cbData(): number;
7
- private _type;
8
- get type(): number;
9
- private _iBit;
10
- get iBit(): number;
11
- private _id;
12
- get id(): number;
13
- /**
14
- * Creates an instance of ColumnDescriptor.
15
- * @param {NodeInfo} nodeInfo
16
- * @param {number} offset
17
- * @memberof ColumnDescriptor
18
- */
19
- constructor(nodeInfo: NodeInfo, offset: number);
20
- /**
21
- * JSON stringify the object properties.
22
- * @returns {string}
23
- * @memberof ColumnDescriptor
24
- */
25
- toJSON(): any;
26
- }
1
+ import { NodeInfo } from './NodeInfo.class';
2
+ export declare class ColumnDescriptor {
3
+ private _ibData;
4
+ get ibData(): number;
5
+ private _cbData;
6
+ get cbData(): number;
7
+ private _type;
8
+ get type(): number;
9
+ private _iBit;
10
+ get iBit(): number;
11
+ private _id;
12
+ get id(): number;
13
+ /**
14
+ * Creates an instance of ColumnDescriptor.
15
+ * @param {NodeInfo} nodeInfo
16
+ * @param {number} offset
17
+ * @memberof ColumnDescriptor
18
+ */
19
+ constructor(nodeInfo: NodeInfo, offset: number);
20
+ /**
21
+ * JSON stringify the object properties.
22
+ * @returns {string}
23
+ * @memberof ColumnDescriptor
24
+ */
25
+ toJSON(): any;
26
+ }
@@ -1,51 +1,51 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ColumnDescriptor = void 0;
7
- /* eslint-disable @typescript-eslint/no-explicit-any */
8
- const long_1 = __importDefault(require("long"));
9
- class ColumnDescriptor {
10
- /**
11
- * Creates an instance of ColumnDescriptor.
12
- * @param {NodeInfo} nodeInfo
13
- * @param {number} offset
14
- * @memberof ColumnDescriptor
15
- */
16
- constructor(nodeInfo, offset) {
17
- this._type = nodeInfo.seekAndReadLong(long_1.default.fromValue(offset), 2).toNumber(); // & 0xFFFF;
18
- this._id = nodeInfo
19
- .seekAndReadLong(long_1.default.fromValue(offset + 2), 2)
20
- .toNumber(); // & 0xFFFF;
21
- this._ibData = nodeInfo
22
- .seekAndReadLong(long_1.default.fromValue(offset + 4), 2)
23
- .toNumber(); // & 0xFFFF;
24
- this._cbData = nodeInfo.pstNodeInputStream.read(); // & 0xFFFF;
25
- this._iBit = nodeInfo.pstNodeInputStream.read(); // & 0xFFFF;
26
- }
27
- get ibData() {
28
- return this._ibData;
29
- }
30
- get cbData() {
31
- return this._cbData;
32
- }
33
- get type() {
34
- return this._type;
35
- }
36
- get iBit() {
37
- return this._iBit;
38
- }
39
- get id() {
40
- return this._id;
41
- }
42
- /**
43
- * JSON stringify the object properties.
44
- * @returns {string}
45
- * @memberof ColumnDescriptor
46
- */
47
- toJSON() {
48
- return this;
49
- }
50
- }
51
- exports.ColumnDescriptor = ColumnDescriptor;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ColumnDescriptor = void 0;
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ const long_1 = __importDefault(require("long"));
9
+ class ColumnDescriptor {
10
+ get ibData() {
11
+ return this._ibData;
12
+ }
13
+ get cbData() {
14
+ return this._cbData;
15
+ }
16
+ get type() {
17
+ return this._type;
18
+ }
19
+ get iBit() {
20
+ return this._iBit;
21
+ }
22
+ get id() {
23
+ return this._id;
24
+ }
25
+ /**
26
+ * Creates an instance of ColumnDescriptor.
27
+ * @param {NodeInfo} nodeInfo
28
+ * @param {number} offset
29
+ * @memberof ColumnDescriptor
30
+ */
31
+ constructor(nodeInfo, offset) {
32
+ this._type = nodeInfo.seekAndReadLong(long_1.default.fromValue(offset), 2).toNumber(); // & 0xFFFF;
33
+ this._id = nodeInfo
34
+ .seekAndReadLong(long_1.default.fromValue(offset + 2), 2)
35
+ .toNumber(); // & 0xFFFF;
36
+ this._ibData = nodeInfo
37
+ .seekAndReadLong(long_1.default.fromValue(offset + 4), 2)
38
+ .toNumber(); // & 0xFFFF;
39
+ this._cbData = nodeInfo.pstNodeInputStream.read(); // & 0xFFFF;
40
+ this._iBit = nodeInfo.pstNodeInputStream.read(); // & 0xFFFF;
41
+ }
42
+ /**
43
+ * JSON stringify the object properties.
44
+ * @returns {string}
45
+ * @memberof ColumnDescriptor
46
+ */
47
+ toJSON() {
48
+ return this;
49
+ }
50
+ }
51
+ exports.ColumnDescriptor = ColumnDescriptor;
@@ -1,26 +1,25 @@
1
- /// <reference types="node" />
2
- import Long from 'long';
3
- export declare class DescriptorIndexNode {
4
- private _descriptorIdentifier;
5
- itemType: number;
6
- get descriptorIdentifier(): number;
7
- private _parentDescriptorIndexIdentifier;
8
- get parentDescriptorIndexIdentifier(): number;
9
- private _localDescriptorsOffsetIndexIdentifier;
10
- get localDescriptorsOffsetIndexIdentifier(): Long;
11
- private _dataOffsetIndexIdentifier;
12
- get dataOffsetIndexIdentifier(): Long;
13
- /**
14
- * Creates an instance of DescriptorIndexNode, a component of the internal descriptor b-tree.
15
- * @param {Buffer} buffer
16
- * @param {number} pstFileType
17
- * @memberof DescriptorIndexNode
18
- */
19
- constructor(buffer: Buffer, pstFileType: number);
20
- /**
21
- * JSON stringify the object properties.
22
- * @returns {string}
23
- * @memberof DescriptorIndexNode
24
- */
25
- toJSON(): any;
26
- }
1
+ import Long from 'long';
2
+ export declare class DescriptorIndexNode {
3
+ private _descriptorIdentifier;
4
+ itemType: number;
5
+ get descriptorIdentifier(): number;
6
+ private _parentDescriptorIndexIdentifier;
7
+ get parentDescriptorIndexIdentifier(): number;
8
+ private _localDescriptorsOffsetIndexIdentifier;
9
+ get localDescriptorsOffsetIndexIdentifier(): Long;
10
+ private _dataOffsetIndexIdentifier;
11
+ get dataOffsetIndexIdentifier(): Long;
12
+ /**
13
+ * Creates an instance of DescriptorIndexNode, a component of the internal descriptor b-tree.
14
+ * @param {Buffer} buffer
15
+ * @param {number} pstFileType
16
+ * @memberof DescriptorIndexNode
17
+ */
18
+ constructor(buffer: Buffer, pstFileType: number);
19
+ /**
20
+ * JSON stringify the object properties.
21
+ * @returns {string}
22
+ * @memberof DescriptorIndexNode
23
+ */
24
+ toJSON(): any;
25
+ }
@@ -1,53 +1,53 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DescriptorIndexNode = void 0;
4
- const PSTFile_class_1 = require("./PSTFile.class");
5
- const PSTUtil_class_1 = require("./PSTUtil.class");
6
- // DescriptorIndexNode is a leaf item from the Descriptor index b-tree
7
- // It is like a pointer to an element in the PST file, everything has one...
8
- class DescriptorIndexNode {
9
- /**
10
- * Creates an instance of DescriptorIndexNode, a component of the internal descriptor b-tree.
11
- * @param {Buffer} buffer
12
- * @param {number} pstFileType
13
- * @memberof DescriptorIndexNode
14
- */
15
- constructor(buffer, pstFileType) {
16
- this.itemType = 0;
17
- if (pstFileType == PSTFile_class_1.PSTFile.PST_TYPE_ANSI) {
18
- this._descriptorIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 0, 4).toNumber();
19
- this._dataOffsetIndexIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 4, 8);
20
- this._localDescriptorsOffsetIndexIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 8, 12);
21
- this._parentDescriptorIndexIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 12, 16).toNumber();
22
- }
23
- else {
24
- this._descriptorIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 0, 4).toNumber();
25
- this._dataOffsetIndexIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 8, 16);
26
- this._localDescriptorsOffsetIndexIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 16, 24);
27
- this._parentDescriptorIndexIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 24, 28).toNumber();
28
- this.itemType = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 28, 32).toNumber();
29
- }
30
- }
31
- get descriptorIdentifier() {
32
- return this._descriptorIdentifier;
33
- }
34
- get parentDescriptorIndexIdentifier() {
35
- return this._parentDescriptorIndexIdentifier;
36
- }
37
- get localDescriptorsOffsetIndexIdentifier() {
38
- return this._localDescriptorsOffsetIndexIdentifier;
39
- }
40
- get dataOffsetIndexIdentifier() {
41
- return this._dataOffsetIndexIdentifier;
42
- }
43
- /**
44
- * JSON stringify the object properties.
45
- * @returns {string}
46
- * @memberof DescriptorIndexNode
47
- */
48
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
- toJSON() {
50
- return this;
51
- }
52
- }
53
- exports.DescriptorIndexNode = DescriptorIndexNode;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DescriptorIndexNode = void 0;
4
+ const PSTFile_class_1 = require("./PSTFile.class");
5
+ const PSTUtil_class_1 = require("./PSTUtil.class");
6
+ // DescriptorIndexNode is a leaf item from the Descriptor index b-tree
7
+ // It is like a pointer to an element in the PST file, everything has one...
8
+ class DescriptorIndexNode {
9
+ get descriptorIdentifier() {
10
+ return this._descriptorIdentifier;
11
+ }
12
+ get parentDescriptorIndexIdentifier() {
13
+ return this._parentDescriptorIndexIdentifier;
14
+ }
15
+ get localDescriptorsOffsetIndexIdentifier() {
16
+ return this._localDescriptorsOffsetIndexIdentifier;
17
+ }
18
+ get dataOffsetIndexIdentifier() {
19
+ return this._dataOffsetIndexIdentifier;
20
+ }
21
+ /**
22
+ * Creates an instance of DescriptorIndexNode, a component of the internal descriptor b-tree.
23
+ * @param {Buffer} buffer
24
+ * @param {number} pstFileType
25
+ * @memberof DescriptorIndexNode
26
+ */
27
+ constructor(buffer, pstFileType) {
28
+ this.itemType = 0;
29
+ if (pstFileType == PSTFile_class_1.PSTFile.PST_TYPE_ANSI) {
30
+ this._descriptorIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 0, 4).toNumber();
31
+ this._dataOffsetIndexIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 4, 8);
32
+ this._localDescriptorsOffsetIndexIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 8, 12);
33
+ this._parentDescriptorIndexIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 12, 16).toNumber();
34
+ }
35
+ else {
36
+ this._descriptorIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 0, 4).toNumber();
37
+ this._dataOffsetIndexIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 8, 16);
38
+ this._localDescriptorsOffsetIndexIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 16, 24);
39
+ this._parentDescriptorIndexIdentifier = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 24, 28).toNumber();
40
+ this.itemType = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(buffer, 28, 32).toNumber();
41
+ }
42
+ }
43
+ /**
44
+ * JSON stringify the object properties.
45
+ * @returns {string}
46
+ * @memberof DescriptorIndexNode
47
+ */
48
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
+ toJSON() {
50
+ return this;
51
+ }
52
+ }
53
+ exports.DescriptorIndexNode = DescriptorIndexNode;
@@ -1,12 +1,11 @@
1
- /// <reference types="node" />
2
- export declare class LZFu {
3
- private static LZFU_HEADER;
4
- /**
5
- * Decompress the buffer of RTF content using LZ
6
- * @static
7
- * @param {Buffer} data
8
- * @returns {string}
9
- * @memberof LZFu
10
- */
11
- static decode(data: Buffer): string;
12
- }
1
+ export declare class LZFu {
2
+ private static LZFU_HEADER;
3
+ /**
4
+ * Decompress the buffer of RTF content using LZ
5
+ * @static
6
+ * @param {Buffer} data
7
+ * @returns {string}
8
+ * @memberof LZFu
9
+ */
10
+ static decode(data: Buffer): string;
11
+ }
@@ -1,95 +1,95 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LZFu = void 0;
4
- const PSTUtil_class_1 = require("./PSTUtil.class");
5
- // An implementation of the LZFu algorithm to decompress RTF content
6
- class LZFu {
7
- /**
8
- * Decompress the buffer of RTF content using LZ
9
- * @static
10
- * @param {Buffer} data
11
- * @returns {string}
12
- * @memberof LZFu
13
- */
14
- static decode(data) {
15
- // const compressedSize: number = PSTUtil.convertLittleEndianBytesToLong(
16
- // data,
17
- // 0,
18
- // 4
19
- // ).toNumber()
20
- const uncompressedSize = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(data, 4, 8).toNumber();
21
- const compressionSig = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(data, 8, 12).toNumber();
22
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
23
- const compressedCRC = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(data, 12, 16).toNumber();
24
- if (compressionSig == 0x75465a4c) {
25
- // we are compressed...
26
- const output = Buffer.alloc(uncompressedSize);
27
- let outputPosition = 0;
28
- const lzBuffer = Buffer.alloc(4096);
29
- // preload our buffer.
30
- try {
31
- const bytes = Buffer.from(LZFu.LZFU_HEADER); //getBytes("US-ASCII");
32
- PSTUtil_class_1.PSTUtil.arraycopy(bytes, 0, lzBuffer, 0, LZFu.LZFU_HEADER.length);
33
- }
34
- catch (err) {
35
- console.error('LZFu::decode cant preload buffer\n' + err);
36
- throw err;
37
- }
38
- let bufferPosition = LZFu.LZFU_HEADER.length;
39
- let currentDataPosition = 16;
40
- // next byte is the flags,
41
- while (currentDataPosition < data.length - 2 &&
42
- outputPosition < output.length) {
43
- let flags = data[currentDataPosition++] & 0xff;
44
- for (let x = 0; x < 8 && outputPosition < output.length; x++) {
45
- const isRef = (flags & 1) == 1;
46
- flags >>= 1;
47
- if (isRef) {
48
- // get the starting point for the buffer and the length to read
49
- const refOffsetOrig = data[currentDataPosition++] & 0xff;
50
- const refSizeOrig = data[currentDataPosition++] & 0xff;
51
- const refOffset = (refOffsetOrig << 4) | (refSizeOrig >>> 4);
52
- const refSize = (refSizeOrig & 0xf) + 2;
53
- try {
54
- // copy the data from the buffer
55
- let index = refOffset;
56
- for (let y = 0; y < refSize && outputPosition < output.length; y++) {
57
- output[outputPosition++] = lzBuffer[index];
58
- lzBuffer[bufferPosition] = lzBuffer[index];
59
- bufferPosition++;
60
- bufferPosition %= 4096;
61
- ++index;
62
- index %= 4096;
63
- }
64
- }
65
- catch (err) {
66
- console.error('LZFu::decode copy the data from the buffer\n' + err);
67
- throw err;
68
- }
69
- }
70
- else {
71
- // copy the byte over
72
- lzBuffer[bufferPosition] = data[currentDataPosition];
73
- bufferPosition++;
74
- bufferPosition %= 4096;
75
- output[outputPosition++] = data[currentDataPosition++];
76
- }
77
- }
78
- }
79
- if (outputPosition != uncompressedSize) {
80
- throw new Error('LZFu::constructor decode Error decompressing RTF');
81
- }
82
- return new String(output).trim();
83
- }
84
- else if (compressionSig == 0x414c454d) {
85
- // we are not compressed!
86
- // just return the rest of the contents as a string
87
- const output = Buffer.alloc(data.length - 16);
88
- PSTUtil_class_1.PSTUtil.arraycopy(data, 16, output, 0, data.length - 16);
89
- return new String(output).trim();
90
- }
91
- return '';
92
- }
93
- }
94
- exports.LZFu = LZFu;
95
- LZFu.LZFU_HEADER = '{\\rtf1\\ansi\\mac\\deff0\\deftab720{\\fonttbl;}{\\f0\\fnil \\froman \\fswiss \\fmodern \\fscript \\fdecor MS Sans SerifSymbolArialTimes New RomanCourier{\\colortbl\\red0\\green0\\blue0\n\r\\par \\pard\\plain\\f0\\fs20\\b\\i\\u\\tab\\tx';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LZFu = void 0;
4
+ const PSTUtil_class_1 = require("./PSTUtil.class");
5
+ // An implementation of the LZFu algorithm to decompress RTF content
6
+ class LZFu {
7
+ /**
8
+ * Decompress the buffer of RTF content using LZ
9
+ * @static
10
+ * @param {Buffer} data
11
+ * @returns {string}
12
+ * @memberof LZFu
13
+ */
14
+ static decode(data) {
15
+ // const compressedSize: number = PSTUtil.convertLittleEndianBytesToLong(
16
+ // data,
17
+ // 0,
18
+ // 4
19
+ // ).toNumber()
20
+ const uncompressedSize = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(data, 4, 8).toNumber();
21
+ const compressionSig = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(data, 8, 12).toNumber();
22
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
23
+ const compressedCRC = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(data, 12, 16).toNumber();
24
+ if (compressionSig == 0x75465a4c) {
25
+ // we are compressed...
26
+ const output = Buffer.alloc(uncompressedSize);
27
+ let outputPosition = 0;
28
+ const lzBuffer = Buffer.alloc(4096);
29
+ // preload our buffer.
30
+ try {
31
+ const bytes = Buffer.from(LZFu.LZFU_HEADER); //getBytes("US-ASCII");
32
+ PSTUtil_class_1.PSTUtil.arraycopy(bytes, 0, lzBuffer, 0, LZFu.LZFU_HEADER.length);
33
+ }
34
+ catch (err) {
35
+ console.error('LZFu::decode cant preload buffer\n' + err);
36
+ throw err;
37
+ }
38
+ let bufferPosition = LZFu.LZFU_HEADER.length;
39
+ let currentDataPosition = 16;
40
+ // next byte is the flags,
41
+ while (currentDataPosition < data.length - 2 &&
42
+ outputPosition < output.length) {
43
+ let flags = data[currentDataPosition++] & 0xff;
44
+ for (let x = 0; x < 8 && outputPosition < output.length; x++) {
45
+ const isRef = (flags & 1) == 1;
46
+ flags >>= 1;
47
+ if (isRef) {
48
+ // get the starting point for the buffer and the length to read
49
+ const refOffsetOrig = data[currentDataPosition++] & 0xff;
50
+ const refSizeOrig = data[currentDataPosition++] & 0xff;
51
+ const refOffset = (refOffsetOrig << 4) | (refSizeOrig >>> 4);
52
+ const refSize = (refSizeOrig & 0xf) + 2;
53
+ try {
54
+ // copy the data from the buffer
55
+ let index = refOffset;
56
+ for (let y = 0; y < refSize && outputPosition < output.length; y++) {
57
+ output[outputPosition++] = lzBuffer[index];
58
+ lzBuffer[bufferPosition] = lzBuffer[index];
59
+ bufferPosition++;
60
+ bufferPosition %= 4096;
61
+ ++index;
62
+ index %= 4096;
63
+ }
64
+ }
65
+ catch (err) {
66
+ console.error('LZFu::decode copy the data from the buffer\n' + err);
67
+ throw err;
68
+ }
69
+ }
70
+ else {
71
+ // copy the byte over
72
+ lzBuffer[bufferPosition] = data[currentDataPosition];
73
+ bufferPosition++;
74
+ bufferPosition %= 4096;
75
+ output[outputPosition++] = data[currentDataPosition++];
76
+ }
77
+ }
78
+ }
79
+ if (outputPosition != uncompressedSize) {
80
+ throw new Error('LZFu::constructor decode Error decompressing RTF');
81
+ }
82
+ return new String(output).trim();
83
+ }
84
+ else if (compressionSig == 0x414c454d) {
85
+ // we are not compressed!
86
+ // just return the rest of the contents as a string
87
+ const output = Buffer.alloc(data.length - 16);
88
+ PSTUtil_class_1.PSTUtil.arraycopy(data, 16, output, 0, data.length - 16);
89
+ return new String(output).trim();
90
+ }
91
+ return '';
92
+ }
93
+ }
94
+ exports.LZFu = LZFu;
95
+ LZFu.LZFU_HEADER = '{\\rtf1\\ansi\\mac\\deff0\\deftab720{\\fonttbl;}{\\f0\\fnil \\froman \\fswiss \\fmodern \\fscript \\fdecor MS Sans SerifSymbolArialTimes New RomanCourier{\\colortbl\\red0\\green0\\blue0\n\r\\par \\pard\\plain\\f0\\fs20\\b\\i\\u\\tab\\tx';
@@ -1,33 +1,33 @@
1
- import Long from 'long';
2
- import { PSTNodeInputStream } from './PSTNodeInputStream.class';
3
- export declare class NodeInfo {
4
- private _startOffset;
5
- get startOffset(): number;
6
- private _endOffset;
7
- get endOffset(): number;
8
- length(): number;
9
- private _pstNodeInputStream;
10
- get pstNodeInputStream(): PSTNodeInputStream;
11
- /**
12
- * Creates an instance of NodeInfo, part of the node table.
13
- * @param {number} start
14
- * @param {number} end
15
- * @param {PSTNodeInputStream} pstNodeInputStream
16
- * @memberof NodeInfo
17
- */
18
- constructor(start: number, end: number, pstNodeInputStream: PSTNodeInputStream);
19
- /**
20
- * Seek to position in node input stream and read a long
21
- * @param {long} offset
22
- * @param {number} length
23
- * @returns {long}
24
- * @memberof NodeInfo
25
- */
26
- seekAndReadLong(offset: Long, length: number): Long;
27
- /**
28
- * JSON stringify the object properties.
29
- * @returns {string}
30
- * @memberof NodeInfo
31
- */
32
- toJSON(): any;
33
- }
1
+ import Long from 'long';
2
+ import { PSTNodeInputStream } from './PSTNodeInputStream.class';
3
+ export declare class NodeInfo {
4
+ private _startOffset;
5
+ get startOffset(): number;
6
+ private _endOffset;
7
+ get endOffset(): number;
8
+ length(): number;
9
+ private _pstNodeInputStream;
10
+ get pstNodeInputStream(): PSTNodeInputStream;
11
+ /**
12
+ * Creates an instance of NodeInfo, part of the node table.
13
+ * @param {number} start
14
+ * @param {number} end
15
+ * @param {PSTNodeInputStream} pstNodeInputStream
16
+ * @memberof NodeInfo
17
+ */
18
+ constructor(start: number, end: number, pstNodeInputStream: PSTNodeInputStream);
19
+ /**
20
+ * Seek to position in node input stream and read a long
21
+ * @param {long} offset
22
+ * @param {number} length
23
+ * @returns {long}
24
+ * @memberof NodeInfo
25
+ */
26
+ seekAndReadLong(offset: Long, length: number): Long;
27
+ /**
28
+ * JSON stringify the object properties.
29
+ * @returns {string}
30
+ * @memberof NodeInfo
31
+ */
32
+ toJSON(): any;
33
+ }