pst-extractor 1.8.0 → 1.9.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.
@@ -1,9 +1,35 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
2
28
  Object.defineProperty(exports, "__esModule", { value: true });
3
29
  exports.PSTNodeInputStream = void 0;
4
30
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
- const long = require("long");
6
- const zlib = require("zlib");
31
+ const long_1 = __importDefault(require("long"));
32
+ const zlib = __importStar(require("zlib"));
7
33
  const PSTDescriptorItem_class_1 = require("./PSTDescriptorItem.class");
8
34
  const PSTUtil_class_1 = require("./PSTUtil.class");
9
35
  const OffsetIndexItem_class_1 = require("./OffsetIndexItem.class");
@@ -15,8 +41,8 @@ class PSTNodeInputStream {
15
41
  this.currentBlock = 0;
16
42
  this.allData = null;
17
43
  this.isZlib = false;
18
- this._currentLocation = long.ZERO;
19
- this._length = long.ZERO;
44
+ this._currentLocation = long_1.default.ZERO;
45
+ this._length = long_1.default.ZERO;
20
46
  this._encrypted = false;
21
47
  this.totalLoopCount = 0;
22
48
  this._pstFile = pstFile;
@@ -29,11 +55,11 @@ class PSTNodeInputStream {
29
55
  this._encrypted =
30
56
  pstFile.encryptionType == PSTFile_class_1.PSTFile.ENCRYPTION_TYPE_COMPRESSIBLE;
31
57
  // we want to get the first block of data and see what we are dealing with
32
- this.loadFromOffsetItem(pstFile.getOffsetIndexNode(long.fromNumber(arg.offsetIndexIdentifier)));
58
+ this.loadFromOffsetItem(pstFile.getOffsetIndexNode(long_1.default.fromNumber(arg.offsetIndexIdentifier)));
33
59
  }
34
60
  else if (arg instanceof Buffer) {
35
61
  this.allData = arg;
36
- this._length = long.fromNumber(this.allData.length);
62
+ this._length = long_1.default.fromNumber(this.allData.length);
37
63
  if (encrypted != undefined) {
38
64
  this._encrypted = encrypted;
39
65
  }
@@ -43,7 +69,7 @@ class PSTNodeInputStream {
43
69
  }
44
70
  }
45
71
  this.currentBlock = 0;
46
- this.currentLocation = long.ZERO;
72
+ this.currentLocation = long_1.default.ZERO;
47
73
  this.detectZlib();
48
74
  }
49
75
  get currentLocation() {
@@ -110,18 +136,18 @@ class PSTNodeInputStream {
110
136
  }
111
137
  }
112
138
  const inData = Buffer.alloc(compressedLength);
113
- this.seek(long.ZERO);
139
+ this.seek(long_1.default.ZERO);
114
140
  this.readCompletely(inData);
115
141
  outputStream = zlib.unzipSync(inData);
116
142
  }
117
143
  this.allData = outputStream;
118
- this.currentLocation = long.ZERO;
144
+ this.currentLocation = long_1.default.ZERO;
119
145
  this.currentBlock = 0;
120
146
  this._length = this.allData
121
- ? long.fromNumber(this.allData.length)
122
- : long.ZERO;
147
+ ? long_1.default.fromNumber(this.allData.length)
148
+ : long_1.default.ZERO;
123
149
  }
124
- this.seek(long.ZERO);
150
+ this.seek(long_1.default.ZERO);
125
151
  }
126
152
  catch (err) {
127
153
  console.error('PSTNodeInputStream::detectZlib Unable to decompress reportedly compressed block\n' +
@@ -160,7 +186,7 @@ class PSTNodeInputStream {
160
186
  this._encrypted = false;
161
187
  }
162
188
  this.allData = data;
163
- this._length = long.fromValue(this.allData.length);
189
+ this._length = long_1.default.fromValue(this.allData.length);
164
190
  }
165
191
  /**
166
192
  * Get block skip points in file.
@@ -202,7 +228,7 @@ class PSTNodeInputStream {
202
228
  // get the details in this block and add it to the list
203
229
  const offsetItem = this.pstFile.getOffsetIndexNode(bid);
204
230
  this.indexItems.push(offsetItem);
205
- this.skipPoints.push(long.fromValue(this.currentLocation));
231
+ this.skipPoints.push(long_1.default.fromValue(this.currentLocation));
206
232
  this.currentLocation = this.currentLocation.add(offsetItem.size);
207
233
  offset += arraySize;
208
234
  }
@@ -396,7 +422,7 @@ class PSTNodeInputStream {
396
422
  */
397
423
  reset() {
398
424
  this.currentBlock = 0;
399
- this._currentLocation = long.ZERO;
425
+ this._currentLocation = long_1.default.ZERO;
400
426
  }
401
427
  /**
402
428
  * Get the offsets (block positions) used in the array
@@ -406,12 +432,12 @@ class PSTNodeInputStream {
406
432
  getBlockOffsets() {
407
433
  const output = [];
408
434
  if (this.skipPoints.length === 0) {
409
- const len = long.fromValue(this.length);
435
+ const len = long_1.default.fromValue(this.length);
410
436
  output.push(len);
411
437
  }
412
438
  else {
413
439
  for (let x = 0; x < this.skipPoints.length; x++) {
414
- const size = long.fromValue(this.indexItems[x].size);
440
+ const size = long_1.default.fromValue(this.indexItems[x].size);
415
441
  output.push(this.skipPoints[x].add(size));
416
442
  }
417
443
  }
@@ -436,7 +462,7 @@ class PSTNodeInputStream {
436
462
  return;
437
463
  }
438
464
  // get us to the right block
439
- let skipPoint = long.ZERO;
465
+ let skipPoint = long_1.default.ZERO;
440
466
  this.currentBlock = 0;
441
467
  if (this.allData == null) {
442
468
  skipPoint = this.skipPoints[this.currentBlock + 1];
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import * as long from 'long';
2
+ import Long from 'long';
3
3
  import { DescriptorIndexNode } from './DescriptorIndexNode.class';
4
4
  import { PSTDescriptorItem } from './PSTDescriptorItem.class';
5
5
  import { PSTFile } from './PSTFile.class';
@@ -41,7 +41,7 @@ export declare abstract class PSTObject {
41
41
  * @type {long}
42
42
  * @memberof PSTObject
43
43
  */
44
- get descriptorNodeId(): long;
44
+ get descriptorNodeId(): Long;
45
45
  /**
46
46
  * Get the node type for the descriptor id.
47
47
  * @param {number} [descriptorIdentifier]
@@ -84,7 +84,7 @@ export declare abstract class PSTObject {
84
84
  * @returns {long}
85
85
  * @memberof PSTObject
86
86
  */
87
- protected getLongItem(identifier: number, defaultValue?: long): long;
87
+ protected getLongItem(identifier: number, defaultValue?: Long): Long;
88
88
  /**
89
89
  * Get a string.
90
90
  * @protected
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.PSTObject = void 0;
4
7
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
- const long = require("long");
8
+ const long_1 = __importDefault(require("long"));
6
9
  const OutlookProperties_1 = require("./OutlookProperties");
7
10
  const PSTNodeInputStream_class_1 = require("./PSTNodeInputStream.class");
8
11
  const PSTTableBC_class_1 = require("./PSTTableBC.class");
@@ -39,7 +42,7 @@ class PSTObject {
39
42
  const pstNodeInputStream = new PSTNodeInputStream_class_1.PSTNodeInputStream(this.pstFile, offsetIndexItem);
40
43
  this.pstTableBC = new PSTTableBC_class_1.PSTTableBC(pstNodeInputStream);
41
44
  this.pstTableItems = this.pstTableBC.getItems();
42
- if (descriptorIndexNode.localDescriptorsOffsetIndexIdentifier.notEquals(long.ZERO)) {
45
+ if (descriptorIndexNode.localDescriptorsOffsetIndexIdentifier.notEquals(long_1.default.ZERO)) {
43
46
  this.localDescriptorItems = this.pstFile.getPSTDescriptorItems(descriptorIndexNode.localDescriptorsOffsetIndexIdentifier);
44
47
  }
45
48
  }
@@ -70,10 +73,10 @@ class PSTObject {
70
73
  get descriptorNodeId() {
71
74
  // Prevent null pointer exceptions for embedded messages
72
75
  if (this.descriptorIndexNode != null) {
73
- return long.fromNumber(this.descriptorIndexNode.descriptorIdentifier);
76
+ return long_1.default.fromNumber(this.descriptorIndexNode.descriptorIdentifier);
74
77
  }
75
78
  else {
76
- return long.ZERO;
79
+ return long_1.default.ZERO;
77
80
  }
78
81
  }
79
82
  /**
@@ -165,13 +168,13 @@ class PSTObject {
165
168
  */
166
169
  getLongItem(identifier, defaultValue) {
167
170
  if (defaultValue === undefined) {
168
- defaultValue = long.ZERO;
171
+ defaultValue = long_1.default.ZERO;
169
172
  }
170
173
  if (this.pstTableItems && this.pstTableItems.has(identifier)) {
171
174
  const item = this.pstTableItems.get(identifier);
172
175
  if (item && item.entryValueType == 0x0003) {
173
176
  // we are really just an int
174
- return long.fromNumber(item.entryValueReference);
177
+ return long_1.default.fromNumber(item.entryValueReference);
175
178
  }
176
179
  else if (item && item.entryValueType == 0x0014) {
177
180
  // we are a long
@@ -1,4 +1,4 @@
1
- import * as long from 'long';
1
+ import Long from 'long';
2
2
  import { NodeInfo } from './NodeInfo.class';
3
3
  import { PSTNodeInputStream } from './PSTNodeInputStream.class';
4
4
  import { PSTDescriptorItem } from './PSTDescriptorItem.class';
@@ -6,7 +6,7 @@ export declare abstract class PSTTable {
6
6
  protected tableType: string;
7
7
  protected tableTypeByte: number;
8
8
  protected hidUserRoot: number;
9
- protected arrayBlocks: long[];
9
+ protected arrayBlocks: Long[];
10
10
  protected sizeOfItemKey: number;
11
11
  protected sizeOfItemValue: number;
12
12
  protected hidRoot: number;
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.PSTTable = void 0;
4
7
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
- const long = require("long");
8
+ const long_1 = __importDefault(require("long"));
6
9
  const NodeInfo_class_1 = require("./NodeInfo.class");
7
10
  const PSTNodeInputStream_class_1 = require("./PSTNodeInputStream.class");
8
11
  // The PST Table is the workhorse of the whole system.
@@ -28,7 +31,7 @@ class PSTTable {
28
31
  this.arrayBlocks = pstNodeInputStream.getBlockOffsets();
29
32
  // the next two bytes should be the table type (bSig)
30
33
  // 0xEC is HN (Heap-on-Node)
31
- pstNodeInputStream.seek(long.ZERO);
34
+ pstNodeInputStream.seek(long_1.default.ZERO);
32
35
  const headdata = Buffer.alloc(4);
33
36
  pstNodeInputStream.readCompletely(headdata);
34
37
  this.tableTypeByte = headdata[3];
@@ -45,19 +48,19 @@ class PSTTable {
45
48
  headdata[3].toString(16));
46
49
  }
47
50
  this.hidUserRoot = pstNodeInputStream
48
- .seekAndReadLong(long.fromValue(4), 4)
51
+ .seekAndReadLong(long_1.default.fromValue(4), 4)
49
52
  .toNumber(); // hidUserRoot
50
53
  // all tables should have a BTHHEADER at hnid == 0x20
51
54
  const headerNodeInfo = this.getNodeInfo(0x20);
52
55
  if (!headerNodeInfo) {
53
56
  throw new Error('PSTTable::constructor headerNodeInfo is null');
54
57
  }
55
- headerNodeInfo.pstNodeInputStream.seek(long.fromValue(headerNodeInfo.startOffset));
58
+ headerNodeInfo.pstNodeInputStream.seek(long_1.default.fromValue(headerNodeInfo.startOffset));
56
59
  let headerByte = headerNodeInfo.pstNodeInputStream.read() & 0xff;
57
60
  if (headerByte != 0xb5) {
58
- headerNodeInfo.pstNodeInputStream.seek(long.fromValue(headerNodeInfo.startOffset));
61
+ headerNodeInfo.pstNodeInputStream.seek(long_1.default.fromValue(headerNodeInfo.startOffset));
59
62
  headerByte = headerNodeInfo.pstNodeInputStream.read() & 0xff;
60
- headerNodeInfo.pstNodeInputStream.seek(long.fromValue(headerNodeInfo.startOffset));
63
+ headerNodeInfo.pstNodeInputStream.seek(long_1.default.fromValue(headerNodeInfo.startOffset));
61
64
  const tmp = Buffer.alloc(1024);
62
65
  headerNodeInfo.pstNodeInputStream.readCompletely(tmp);
63
66
  throw new Error("PSTTable::constructor Unable to parse table, can't find BTHHEADER header information: " +
@@ -67,7 +70,7 @@ class PSTTable {
67
70
  this.sizeOfItemValue = headerNodeInfo.pstNodeInputStream.read() & 0xff; // Size of value in key table
68
71
  this.numberOfIndexLevels = headerNodeInfo.pstNodeInputStream.read() & 0xff;
69
72
  this.hidRoot = headerNodeInfo
70
- .seekAndReadLong(long.fromValue(4), 4)
73
+ .seekAndReadLong(long_1.default.fromValue(4), 4)
71
74
  .toNumber();
72
75
  }
73
76
  /**
@@ -133,20 +136,20 @@ class PSTTable {
133
136
  }
134
137
  // Get offset of HN page map
135
138
  let iHeapNodePageMap = this.pstNodeInputStream
136
- .seekAndReadLong(long.fromValue(blockOffset), 2)
139
+ .seekAndReadLong(long_1.default.fromValue(blockOffset), 2)
137
140
  .toNumber() + blockOffset;
138
141
  const cAlloc = this.pstNodeInputStream
139
- .seekAndReadLong(long.fromValue(iHeapNodePageMap), 2)
142
+ .seekAndReadLong(long_1.default.fromValue(iHeapNodePageMap), 2)
140
143
  .toNumber();
141
144
  if (index >= cAlloc + 1) {
142
145
  throw new Error("PSTTable::getNodeInfo: node index doesn't exist! nid = " + hnid);
143
146
  }
144
147
  iHeapNodePageMap += 2 * index + 2;
145
148
  const start = this.pstNodeInputStream
146
- .seekAndReadLong(long.fromValue(iHeapNodePageMap), 2)
149
+ .seekAndReadLong(long_1.default.fromValue(iHeapNodePageMap), 2)
147
150
  .toNumber() + blockOffset;
148
151
  const end = this.pstNodeInputStream
149
- .seekAndReadLong(long.fromValue(iHeapNodePageMap + 2), 2)
152
+ .seekAndReadLong(long_1.default.fromValue(iHeapNodePageMap + 2), 2)
150
153
  .toNumber() + blockOffset;
151
154
  return new NodeInfo_class_1.NodeInfo(start, end, this.pstNodeInputStream);
152
155
  }
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.PSTTable7C = void 0;
4
7
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
8
  /* eslint-disable @typescript-eslint/camelcase */
6
9
  /* eslint-disable @typescript-eslint/no-unused-vars */
7
- const long = require("long");
10
+ const long_1 = __importDefault(require("long"));
8
11
  const PSTFile_class_1 = require("./PSTFile.class");
9
12
  const PSTTable_class_1 = require("./PSTTable.class");
10
13
  const PSTTableItem_class_1 = require("./PSTTableItem.class");
@@ -38,25 +41,25 @@ class PSTTable7C extends PSTTable_class_1.PSTTable {
38
41
  // get the TCINFO header information
39
42
  let offset = 0;
40
43
  this.numColumns = tcHeaderNode
41
- .seekAndReadLong(long.fromNumber(offset + 1), 1)
44
+ .seekAndReadLong(long_1.default.fromNumber(offset + 1), 1)
42
45
  .toNumber();
43
46
  const TCI_4b = tcHeaderNode
44
- .seekAndReadLong(long.fromNumber(offset + 2), 2)
47
+ .seekAndReadLong(long_1.default.fromNumber(offset + 2), 2)
45
48
  .toNumber();
46
49
  const TCI_2b = tcHeaderNode
47
- .seekAndReadLong(long.fromNumber(offset + 4), 2)
50
+ .seekAndReadLong(long_1.default.fromNumber(offset + 4), 2)
48
51
  .toNumber();
49
52
  this.TCI_1b = tcHeaderNode
50
- .seekAndReadLong(long.fromNumber(offset + 6), 2)
53
+ .seekAndReadLong(long_1.default.fromNumber(offset + 6), 2)
51
54
  .toNumber();
52
55
  this.TCI_bm = tcHeaderNode
53
- .seekAndReadLong(long.fromNumber(offset + 8), 2)
56
+ .seekAndReadLong(long_1.default.fromNumber(offset + 8), 2)
54
57
  .toNumber();
55
58
  const hidRowIndex = tcHeaderNode
56
- .seekAndReadLong(long.fromNumber(offset + 10), 4)
59
+ .seekAndReadLong(long_1.default.fromNumber(offset + 10), 4)
57
60
  .toNumber();
58
61
  const hnidRows = tcHeaderNode
59
- .seekAndReadLong(long.fromNumber(offset + 14), 4)
62
+ .seekAndReadLong(long_1.default.fromNumber(offset + 14), 4)
60
63
  .toNumber();
61
64
  // 22... column descriptors
62
65
  offset += 22;
@@ -83,11 +86,11 @@ class PSTTable7C extends PSTTable_class_1.PSTTable {
83
86
  offset = 0;
84
87
  for (let x = 0; x < this.numberOfKeys; x++) {
85
88
  const context = keyTableInfo
86
- .seekAndReadLong(long.fromNumber(offset), this.sizeOfItemKey)
89
+ .seekAndReadLong(long_1.default.fromNumber(offset), this.sizeOfItemKey)
87
90
  .toNumber();
88
91
  offset += this.sizeOfItemKey;
89
92
  const rowIndex = keyTableInfo
90
- .seekAndReadLong(long.fromNumber(offset), this.sizeOfItemValue)
93
+ .seekAndReadLong(long_1.default.fromNumber(offset), this.sizeOfItemValue)
91
94
  .toNumber();
92
95
  offset += this.sizeOfItemValue;
93
96
  this.keyMap.set(context, rowIndex);
@@ -162,14 +165,14 @@ class PSTTable7C extends PSTTable_class_1.PSTTable {
162
165
  }
163
166
  }
164
167
  const bitmap = Buffer.alloc((this.numColumns + 7) / 8);
165
- this.rowNodeInfo.pstNodeInputStream.seek(long.fromNumber(this.rowNodeInfo.startOffset + currentValueArrayStart + this.TCI_1b));
168
+ this.rowNodeInfo.pstNodeInputStream.seek(long_1.default.fromNumber(this.rowNodeInfo.startOffset + currentValueArrayStart + this.TCI_1b));
166
169
  this.rowNodeInfo.pstNodeInputStream.readCompletely(bitmap);
167
- const id = this.rowNodeInfo.seekAndReadLong(long.fromNumber(currentValueArrayStart), 4);
170
+ const id = this.rowNodeInfo.seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart), 4);
168
171
  // Put into the item map as PidTagLtpRowId (0x67F2)
169
172
  let item = new PSTTableItem_class_1.PSTTableItem();
170
173
  item.itemIndex = -1;
171
174
  item.entryValueType = 3;
172
- item.entryType = long.fromNumber(0x67f2);
175
+ item.entryType = long_1.default.fromNumber(0x67f2);
173
176
  item.entryValueReference = id.toNumber();
174
177
  item.isExternalValueReference = true;
175
178
  currentItem.set(item.entryType.toNumber(), item);
@@ -189,26 +192,26 @@ class PSTTable7C extends PSTTable_class_1.PSTTable {
189
192
  item = new PSTTableItem_class_1.PSTTableItem();
190
193
  item.itemIndex = col;
191
194
  item.entryValueType = this.columnDescriptors[col].type;
192
- item.entryType = long.fromNumber(this.columnDescriptors[col].id);
195
+ item.entryType = long_1.default.fromNumber(this.columnDescriptors[col].id);
193
196
  item.entryValueReference = 0;
194
197
  switch (this.columnDescriptors[col].cbData) {
195
198
  case 1: // Single byte data
196
199
  item.entryValueReference =
197
200
  this.rowNodeInfo
198
- .seekAndReadLong(long.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 1)
201
+ .seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 1)
199
202
  .toNumber() & 0xff;
200
203
  item.isExternalValueReference = true;
201
204
  break;
202
205
  case 2: // Two byte data
203
206
  item.entryValueReference =
204
207
  this.rowNodeInfo
205
- .seekAndReadLong(long.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 2)
208
+ .seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 2)
206
209
  .toNumber() & 0xffff;
207
210
  item.isExternalValueReference = true;
208
211
  break;
209
212
  case 8: // 8 byte data
210
213
  item.data = Buffer.alloc(8);
211
- this.rowNodeInfo.pstNodeInputStream.seek(long.fromNumber(this.rowNodeInfo.startOffset +
214
+ this.rowNodeInfo.pstNodeInputStream.seek(long_1.default.fromNumber(this.rowNodeInfo.startOffset +
212
215
  currentValueArrayStart +
213
216
  this.columnDescriptors[col].ibData));
214
217
  this.rowNodeInfo.pstNodeInputStream.readCompletely(item.data);
@@ -216,7 +219,7 @@ class PSTTable7C extends PSTTable_class_1.PSTTable {
216
219
  default:
217
220
  // Four byte data
218
221
  item.entryValueReference = this.rowNodeInfo
219
- .seekAndReadLong(long.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 4)
222
+ .seekAndReadLong(long_1.default.fromNumber(currentValueArrayStart + this.columnDescriptors[col].ibData), 4)
220
223
  .toNumber();
221
224
  if (this.columnDescriptors[col].type == 0x0003 ||
222
225
  this.columnDescriptors[col].type == 0x0004 ||
@@ -239,7 +242,7 @@ class PSTTable7C extends PSTTable_class_1.PSTTable {
239
242
  const entryInfo = this.getNodeInfo(item.entryValueReference);
240
243
  if (entryInfo) {
241
244
  item.data = Buffer.alloc(entryInfo.length());
242
- entryInfo.pstNodeInputStream.seek(long.fromNumber(entryInfo.startOffset));
245
+ entryInfo.pstNodeInputStream.seek(long_1.default.fromNumber(entryInfo.startOffset));
243
246
  entryInfo.pstNodeInputStream.readCompletely(item.data);
244
247
  }
245
248
  }
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.PSTTableBC = void 0;
4
7
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
- const long = require("long");
8
+ const long_1 = __importDefault(require("long"));
6
9
  const PSTTable_class_1 = require("./PSTTable.class");
7
10
  const PSTTableItem_class_1 = require("./PSTTableItem.class");
8
11
  const PSTUtil_class_1 = require("./PSTUtil.class");
@@ -25,7 +28,7 @@ class PSTTableBC extends PSTTable_class_1.PSTTable {
25
28
  throw new Error('PSTTableBC::constructor keyTableInfoNodeInfo is null');
26
29
  }
27
30
  const keyTableInfo = Buffer.alloc(keyTableInfoNodeInfo.length());
28
- keyTableInfoNodeInfo.pstNodeInputStream.seek(long.fromValue(keyTableInfoNodeInfo.startOffset));
31
+ keyTableInfoNodeInfo.pstNodeInputStream.seek(long_1.default.fromValue(keyTableInfoNodeInfo.startOffset));
29
32
  keyTableInfoNodeInfo.pstNodeInputStream.readCompletely(keyTableInfo);
30
33
  this.numberOfKeys = Math.trunc(keyTableInfo.length / (this.sizeOfItemKey + this.sizeOfItemValue));
31
34
  if (this.numberOfKeys == 0) {
@@ -64,7 +67,7 @@ class PSTTableBC extends PSTTable_class_1.PSTTable {
64
67
  else {
65
68
  // Make a copy of the data
66
69
  const nodeInfo = Buffer.alloc(nodeInfoNodeInfo.length());
67
- nodeInfoNodeInfo.pstNodeInputStream.seek(long.fromValue(nodeInfoNodeInfo.startOffset));
70
+ nodeInfoNodeInfo.pstNodeInputStream.seek(long_1.default.fromValue(nodeInfoNodeInfo.startOffset));
68
71
  nodeInfoNodeInfo.pstNodeInputStream.readCompletely(nodeInfo);
69
72
  item.data = nodeInfo; // should be new array, so just use it
70
73
  item.isExternalValueReference = false;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import * as long from 'long';
2
+ import Long from 'long';
3
3
  export declare class PSTTableItem {
4
4
  static VALUE_TYPE_PT_UNICODE: number;
5
5
  static VALUE_TYPE_PT_STRING8: number;
@@ -8,8 +8,8 @@ export declare class PSTTableItem {
8
8
  set itemIndex(val: number);
9
9
  get itemIndex(): number;
10
10
  private _entryType;
11
- set entryType(val: long);
12
- get entryType(): long;
11
+ set entryType(val: Long);
12
+ get entryType(): Long;
13
13
  private _isExternalValueReference;
14
14
  set isExternalValueReference(val: boolean);
15
15
  get isExternalValueReference(): boolean;
@@ -31,7 +31,7 @@ export declare class PSTTableItem {
31
31
  * @returns
32
32
  * @memberof PSTTableItem
33
33
  */
34
- getLongValue(): -1 | long.Long;
34
+ getLongValue(): -1 | Long;
35
35
  /**
36
36
  * Get string value of data.
37
37
  * @param {number} [stringType]
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.PSTTableItem = void 0;
4
7
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
- const long = require("long");
8
+ const long_1 = __importDefault(require("long"));
6
9
  const PSTUtil_class_1 = require("./PSTUtil.class");
7
10
  // Generic table item
8
11
  // Provides some basic string functions
9
12
  class PSTTableItem {
10
13
  constructor() {
11
14
  this._itemIndex = 0;
12
- this._entryType = long.ZERO;
15
+ this._entryType = long_1.default.ZERO;
13
16
  this._isExternalValueReference = false;
14
17
  this._entryValueReference = 0;
15
18
  this._entryValueType = 0;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import * as long from 'long';
2
+ import Long from 'long';
3
3
  import { DescriptorIndexNode } from './DescriptorIndexNode.class';
4
4
  import { PSTDescriptorItem } from './PSTDescriptorItem.class';
5
5
  import { PSTFile } from './PSTFile.class';
@@ -43,7 +43,7 @@ export declare class PSTUtil {
43
43
  * @returns {long}
44
44
  * @memberof PSTUtil
45
45
  */
46
- static convertLittleEndianBytesToLong(data: Buffer, start?: number, end?: number): long;
46
+ static convertLittleEndianBytesToLong(data: Buffer, start?: number, end?: number): Long;
47
47
  /**
48
48
  * Convert big endian bytes to long
49
49
  * @static
@@ -53,7 +53,7 @@ export declare class PSTUtil {
53
53
  * @returns {long}
54
54
  * @memberof PSTUtil
55
55
  */
56
- static convertBigEndianBytesToLong(data: Buffer, start?: number, end?: number): long;
56
+ static convertBigEndianBytesToLong(data: Buffer, start?: number, end?: number): Long;
57
57
  /**
58
58
  * Handle strings using codepages.
59
59
  * @static
@@ -106,7 +106,7 @@ export declare class PSTUtil {
106
106
  * @returns {*}
107
107
  * @memberof PSTUtil
108
108
  */
109
- static detectAndLoadPSTObject(theFile: PSTFile, descriptorIndex: long): any;
109
+ static detectAndLoadPSTObject(theFile: PSTFile, descriptorIndex: Long): any;
110
110
  static detectAndLoadPSTObject(theFile: PSTFile, folderIndexNode: DescriptorIndexNode): any;
111
111
  /**
112
112
  * Creates object based on message class
@@ -131,5 +131,5 @@ export declare class PSTUtil {
131
131
  * @returns {Date}
132
132
  * @memberof PSTUtil
133
133
  */
134
- static filetimeToDate(hi: long, low: long): Date;
134
+ static filetimeToDate(hi: Long, low: Long): Date;
135
135
  }
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.PSTUtil = void 0;
4
7
  /* eslint-disable @typescript-eslint/no-explicit-any */
5
- const long = require("long");
8
+ const long_1 = __importDefault(require("long"));
6
9
  const PSTAppointment_class_1 = require("./PSTAppointment.class");
7
10
  const PSTContact_class_1 = require("./PSTContact.class");
8
11
  const PSTFolder_class_1 = require("./PSTFolder.class");
@@ -11,6 +14,7 @@ const PSTNodeInputStream_class_1 = require("./PSTNodeInputStream.class");
11
14
  const PSTTableBC_class_1 = require("./PSTTableBC.class");
12
15
  const PSTTask_class_1 = require("./PSTTask.class");
13
16
  const PSTActivity_class_1 = require("./PSTActivity.class");
17
+ const iconv_lite_1 = __importDefault(require("iconv-lite"));
14
18
  /**
15
19
  * Utility functions for PST components
16
20
  * @export
@@ -33,11 +37,11 @@ class PSTUtil {
33
37
  if (!end) {
34
38
  end = data.length;
35
39
  }
36
- let offset = long.fromNumber(data[end - 1] & 0xff);
40
+ let offset = long_1.default.fromNumber(data[end - 1] & 0xff);
37
41
  let tmpLongValue;
38
42
  for (let x = end - 2; x >= start; x--) {
39
43
  offset = offset.shiftLeft(8);
40
- tmpLongValue = long.fromNumber(data[x] & 0xff);
44
+ tmpLongValue = long_1.default.fromNumber(data[x] & 0xff);
41
45
  offset = offset.xor(tmpLongValue);
42
46
  }
43
47
  return offset;
@@ -58,10 +62,10 @@ class PSTUtil {
58
62
  if (!end) {
59
63
  end = data.length;
60
64
  }
61
- let offset = long.ZERO;
65
+ let offset = long_1.default.ZERO;
62
66
  for (let x = start; x < end; ++x) {
63
67
  offset = offset.shiftLeft(8);
64
- const tmpLongValue = long.fromNumber(data[x] & 0xff);
68
+ const tmpLongValue = long_1.default.fromNumber(data[x] & 0xff);
65
69
  offset = offset.xor(tmpLongValue);
66
70
  }
67
71
  return offset;
@@ -85,15 +89,16 @@ class PSTUtil {
85
89
  * @returns
86
90
  * @memberof PSTUtil
87
91
  */
88
- static createJavascriptString(data, stringType,
89
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
90
- codepage) {
92
+ static createJavascriptString(data, stringType, codepage = 'utf8') {
91
93
  // TODO - codepage is not used...
92
94
  try {
93
95
  if (stringType == 0x1f) {
94
96
  // convert and trim any nulls
95
97
  return data.toString('utf16le').replace(/\0/g, '');
96
98
  }
99
+ else {
100
+ return iconv_lite_1.default.decode(data, codepage).toString();
101
+ }
97
102
  }
98
103
  catch (err) {
99
104
  console.error('PSTUtil::createJavascriptString Unable to decode string\n' + err);
@@ -290,7 +295,7 @@ class PSTUtil {
290
295
  const l = low.and(0xffffffff);
291
296
  const filetime = h.or(l);
292
297
  const msSince16010101 = filetime.divide(1000 * 10);
293
- const epochDiff = long.fromValue('11644473600000');
298
+ const epochDiff = long_1.default.fromValue('11644473600000');
294
299
  const msSince19700101 = msSince16010101.subtract(epochDiff);
295
300
  return new Date(msSince19700101.toNumber());
296
301
  }