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,317 +1,317 @@
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.PSTAttachment = void 0;
7
- /* eslint-disable @typescript-eslint/no-explicit-any */
8
- const long_1 = __importDefault(require("long"));
9
- const OutlookProperties_1 = require("./OutlookProperties");
10
- const PSTNodeInputStream_class_1 = require("./PSTNodeInputStream.class");
11
- const PSTObject_class_1 = require("./PSTObject.class");
12
- const PSTTableBC_class_1 = require("./PSTTableBC.class");
13
- const PSTUtil_class_1 = require("./PSTUtil.class");
14
- // Class containing attachment information.
15
- class PSTAttachment extends PSTObject_class_1.PSTObject {
16
- /**
17
- * Creates an instance of PSTAttachment.
18
- * @param {PSTFile} pstFile
19
- * @param {PSTTableBC} table
20
- * @param {Map<number, PSTDescriptorItem>} localDescriptorItems
21
- * @memberof PSTAttachment
22
- */
23
- constructor(pstFile, table, localDescriptorItems) {
24
- super(pstFile);
25
- // pre-populate folder object with values
26
- this.prePopulate(null, table, localDescriptorItems);
27
- }
28
- /**
29
- * The PR_ATTACH_SIZE property contains the sum, in bytes, of the sizes of all properties on an attachment.
30
- * https://msdn.microsoft.com/en-us/library/gg156074(v=winembedded.70).aspx
31
- * @readonly
32
- * @type {number}
33
- * @memberof PSTAttachment
34
- */
35
- get size() {
36
- return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_SIZE);
37
- }
38
- /**
39
- * Contains the creation date and time of a message.
40
- * https://msdn.microsoft.com/en-us/library/office/cc765677.aspx
41
- * @readonly
42
- * @type {Date}
43
- * @memberof PSTAttachment
44
- */
45
- get creationTime() {
46
- return this.getDateItem(OutlookProperties_1.OutlookProperties.PR_CREATION_TIME);
47
- }
48
- /**
49
- * Contains the date and time when the object or subobject was last modified.
50
- * https://msdn.microsoft.com/en-us/library/office/cc815689.aspx
51
- * @readonly
52
- * @type {Date}
53
- * @memberof PSTAttachment
54
- */
55
- get modificationTime() {
56
- return this.getDateItem(OutlookProperties_1.OutlookProperties.PR_LAST_MODIFICATION_TIME);
57
- }
58
- /**
59
- * Get an embedded message.
60
- * @readonly
61
- * @type {PSTMessage}
62
- * @memberof PSTAttachment
63
- */
64
- get embeddedPSTMessage() {
65
- let pstNodeInputStream = null;
66
- if (this.getIntItem(0x3705) == PSTAttachment.ATTACHMENT_METHOD_EMBEDDED) {
67
- const item = this.pstTableItems ? this.pstTableItems.get(0x3701) : null;
68
- if (item && item.entryValueType == 0x0102) {
69
- if (!item.isExternalValueReference) {
70
- pstNodeInputStream = new PSTNodeInputStream_class_1.PSTNodeInputStream(this.pstFile, item.data);
71
- }
72
- else {
73
- // We are in trouble!
74
- throw new Error('PSTAttachment::getEmbeddedPSTMessage External reference in getEmbeddedPSTMessage()!');
75
- }
76
- }
77
- else if (item && item.entryValueType == 0x000d) {
78
- const descriptorItem = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(item.data, 0, 4).toNumber();
79
- const descriptorItemNested = this.localDescriptorItems
80
- ? this.localDescriptorItems.get(descriptorItem)
81
- : null;
82
- if (descriptorItemNested) {
83
- pstNodeInputStream = new PSTNodeInputStream_class_1.PSTNodeInputStream(this.pstFile, descriptorItemNested);
84
- if (descriptorItemNested &&
85
- descriptorItemNested.subNodeOffsetIndexIdentifier > 0) {
86
- this.localDescriptorItems = this.pstFile.getPSTDescriptorItems(long_1.default.fromNumber(descriptorItemNested.subNodeOffsetIndexIdentifier));
87
- }
88
- }
89
- }
90
- if (!pstNodeInputStream) {
91
- return null;
92
- }
93
- try {
94
- const attachmentTable = new PSTTableBC_class_1.PSTTableBC(pstNodeInputStream);
95
- if (this.localDescriptorItems && this.descriptorIndexNode) {
96
- return PSTUtil_class_1.PSTUtil.createAppropriatePSTMessageObject(this.pstFile, this.descriptorIndexNode, attachmentTable, this.localDescriptorItems);
97
- }
98
- }
99
- catch (err) {
100
- console.error('PSTAttachment::embeddedPSTMessage createAppropriatePSTMessageObject failed\n' +
101
- err);
102
- throw err;
103
- }
104
- }
105
- return null;
106
- }
107
- /**
108
- * The file input stream.
109
- * https://msdn.microsoft.com/en-us/library/gg154634(v=winembedded.70).aspx
110
- * @readonly
111
- * @type {PSTNodeInputStream}
112
- * @memberof PSTAttachment
113
- */
114
- get fileInputStream() {
115
- const attachmentDataObject = this.pstTableItems
116
- ? this.pstTableItems.get(OutlookProperties_1.OutlookProperties.PR_ATTACH_DATA_BIN)
117
- : null;
118
- if (!attachmentDataObject) {
119
- return null;
120
- }
121
- else if (attachmentDataObject.isExternalValueReference) {
122
- const descriptorItemNested = this.localDescriptorItems
123
- ? this.localDescriptorItems.get(attachmentDataObject.entryValueReference)
124
- : null;
125
- if (descriptorItemNested) {
126
- return new PSTNodeInputStream_class_1.PSTNodeInputStream(this.pstFile, descriptorItemNested);
127
- }
128
- }
129
- else {
130
- // internal value references are never encrypted
131
- return new PSTNodeInputStream_class_1.PSTNodeInputStream(this.pstFile, attachmentDataObject.data, false);
132
- }
133
- return null;
134
- }
135
- /**
136
- * Size of the attachment file itself.
137
- * https://msdn.microsoft.com/en-us/library/gg154634(v=winembedded.70).aspx
138
- * @readonly
139
- * @type {number}
140
- * @memberof PSTAttachment
141
- */
142
- get filesize() {
143
- const attachmentDataObject = this.pstTableItems
144
- ? this.pstTableItems.get(OutlookProperties_1.OutlookProperties.PR_ATTACH_DATA_BIN)
145
- : null;
146
- if (attachmentDataObject && attachmentDataObject.isExternalValueReference) {
147
- const descriptorItemNested = this.localDescriptorItems
148
- ? this.localDescriptorItems.get(attachmentDataObject.entryValueReference)
149
- : null;
150
- if (descriptorItemNested == null) {
151
- throw new Error('PSTAttachment::filesize missing attachment descriptor item for: ' +
152
- attachmentDataObject.entryValueReference);
153
- }
154
- return descriptorItemNested.dataSize;
155
- }
156
- else if (attachmentDataObject) {
157
- // raw attachment data, right there!
158
- return attachmentDataObject.data.length;
159
- }
160
- return 0;
161
- }
162
- /**
163
- * Contains an attachment's base file name and extension, excluding path.
164
- * https://msdn.microsoft.com/en-us/library/office/cc842517.aspx
165
- * @readonly
166
- * @type {string}
167
- * @memberof PSTAttachment
168
- */
169
- get filename() {
170
- return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_FILENAME);
171
- }
172
- /**
173
- * Contains a MAPI-defined constant representing the way the contents of an attachment can be accessed.
174
- * https://msdn.microsoft.com/en-us/library/office/cc815439.aspx
175
- * @readonly
176
- * @type {number}
177
- * @memberof PSTAttachment
178
- */
179
- get attachMethod() {
180
- return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_METHOD);
181
- }
182
- /**
183
- * Contains a number that uniquely identifies the attachment within its parent message.
184
- * https://msdn.microsoft.com/en-us/library/office/cc841969.aspx
185
- * @readonly
186
- * @type {number}
187
- * @memberof PSTAttachment
188
- */
189
- get attachNum() {
190
- return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_NUM);
191
- }
192
- /**
193
- * Contains an attachment's long filename and extension, excluding path.
194
- * https://msdn.microsoft.com/en-us/library/office/cc842157.aspx
195
- * @readonly
196
- * @type {string}
197
- * @memberof PSTAttachment
198
- */
199
- get longFilename() {
200
- return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_LONG_FILENAME);
201
- }
202
- /**
203
- * Contains an attachment's fully-qualified path and filename.
204
- * https://msdn.microsoft.com/en-us/library/office/cc839889.aspx
205
- * @readonly
206
- * @type {string}
207
- * @memberof PSTAttachment
208
- */
209
- get pathname() {
210
- return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_PATHNAME);
211
- }
212
- /**
213
- * Contains an offset, in characters, to use in rendering an attachment within the main message text.
214
- * https://msdn.microsoft.com/en-us/library/office/cc842381.aspx
215
- * @readonly
216
- * @type {number}
217
- * @memberof PSTAttachment
218
- */
219
- get renderingPosition() {
220
- return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_RENDERING_POSITION);
221
- }
222
- /**
223
- * Contains an attachment's fully-qualified long path and filename.
224
- * https://msdn.microsoft.com/en-us/library/office/cc815443.aspx
225
- * @readonly
226
- * @type {string}
227
- * @memberof PSTAttachment
228
- */
229
- get longPathname() {
230
- return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_LONG_PATHNAME);
231
- }
232
- /**
233
- * Contains formatting information about a Multipurpose Internet Mail Extensions (MIME) attachment.
234
- * https://msdn.microsoft.com/en-us/library/office/cc842516.aspx
235
- * @readonly
236
- * @type {string}
237
- * @memberof PSTAttachment
238
- */
239
- get mimeTag() {
240
- return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_MIME_TAG);
241
- }
242
- /**
243
- * Contains the MIME sequence number of a MIME message attachment.
244
- * https://msdn.microsoft.com/en-us/library/office/cc963256.aspx
245
- * @readonly
246
- * @type {number}
247
- * @memberof PSTAttachment
248
- */
249
- get mimeSequence() {
250
- return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_MIME_SEQUENCE);
251
- }
252
- /**
253
- * Contains the content identification header of a Multipurpose Internet Mail Extensions (MIME) message attachment.
254
- * https://msdn.microsoft.com/en-us/library/office/cc765868.aspx
255
- * @readonly
256
- * @type {string}
257
- * @memberof PSTAttachment
258
- */
259
- get contentId() {
260
- return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_CONTENT_ID);
261
- }
262
- /**
263
- * Indicates that this attachment is not available to HTML rendering applications and should be ignored in Multipurpose Internet Mail Extensions (MIME) processing.
264
- * https://msdn.microsoft.com/en-us/library/office/cc765876.aspx
265
- * @readonly
266
- * @type {boolean}
267
- * @memberof PSTAttachment
268
- */
269
- get isAttachmentInvisibleInHtml() {
270
- const actionFlag = this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_FLAGS);
271
- return (actionFlag & 0x1) > 0;
272
- }
273
- /**
274
- * Indicates that this attachment is not available to applications rendering in Rich Text Format (RTF) and should be ignored by MAPI.
275
- * https://msdn.microsoft.com/en-us/library/office/cc765876.aspx
276
- * @readonly
277
- * @type {boolean}
278
- * @memberof PSTAttachment
279
- */
280
- get isAttachmentInvisibleInRTF() {
281
- const actionFlag = this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_FLAGS);
282
- return (actionFlag & 0x2) > 0;
283
- }
284
- /**
285
- * JSON stringify the object properties.
286
- * @returns {string}
287
- * @memberof PSTAttachment
288
- */
289
- toJSON() {
290
- const clone = Object.assign({
291
- size: this.size,
292
- creationTime: this.creationTime,
293
- modificationTime: this.modificationTime,
294
- filename: this.filename,
295
- attachMethod: this.attachMethod,
296
- attachNum: this.attachNum,
297
- longFilename: this.longFilename,
298
- pathname: this.pathname,
299
- renderingPosition: this.renderingPosition,
300
- longPathname: this.longPathname,
301
- mimeTag: this.mimeTag,
302
- mimeSequence: this.mimeSequence,
303
- contentId: this.contentId,
304
- isAttachmentInvisibleInHtml: this.isAttachmentInvisibleInHtml,
305
- isAttachmentInvisibleInRTF: this.isAttachmentInvisibleInRTF,
306
- }, this);
307
- return clone;
308
- }
309
- }
310
- exports.PSTAttachment = PSTAttachment;
311
- PSTAttachment.ATTACHMENT_METHOD_NONE = 0;
312
- PSTAttachment.ATTACHMENT_METHOD_BY_VALUE = 1;
313
- PSTAttachment.ATTACHMENT_METHOD_BY_REFERENCE = 2;
314
- PSTAttachment.ATTACHMENT_METHOD_BY_REFERENCE_RESOLVE = 3;
315
- PSTAttachment.ATTACHMENT_METHOD_BY_REFERENCE_ONLY = 4;
316
- PSTAttachment.ATTACHMENT_METHOD_EMBEDDED = 5;
317
- PSTAttachment.ATTACHMENT_METHOD_OLE = 6;
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.PSTAttachment = void 0;
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ const long_1 = __importDefault(require("long"));
9
+ const OutlookProperties_1 = require("./OutlookProperties");
10
+ const PSTNodeInputStream_class_1 = require("./PSTNodeInputStream.class");
11
+ const PSTObject_class_1 = require("./PSTObject.class");
12
+ const PSTTableBC_class_1 = require("./PSTTableBC.class");
13
+ const PSTUtil_class_1 = require("./PSTUtil.class");
14
+ // Class containing attachment information.
15
+ class PSTAttachment extends PSTObject_class_1.PSTObject {
16
+ /**
17
+ * Creates an instance of PSTAttachment.
18
+ * @param {PSTFile} pstFile
19
+ * @param {PSTTableBC} table
20
+ * @param {Map<number, PSTDescriptorItem>} localDescriptorItems
21
+ * @memberof PSTAttachment
22
+ */
23
+ constructor(pstFile, table, localDescriptorItems) {
24
+ super(pstFile);
25
+ // pre-populate folder object with values
26
+ this.prePopulate(null, table, localDescriptorItems);
27
+ }
28
+ /**
29
+ * The PR_ATTACH_SIZE property contains the sum, in bytes, of the sizes of all properties on an attachment.
30
+ * https://msdn.microsoft.com/en-us/library/gg156074(v=winembedded.70).aspx
31
+ * @readonly
32
+ * @type {number}
33
+ * @memberof PSTAttachment
34
+ */
35
+ get size() {
36
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_SIZE);
37
+ }
38
+ /**
39
+ * Contains the creation date and time of a message.
40
+ * https://msdn.microsoft.com/en-us/library/office/cc765677.aspx
41
+ * @readonly
42
+ * @type {Date}
43
+ * @memberof PSTAttachment
44
+ */
45
+ get creationTime() {
46
+ return this.getDateItem(OutlookProperties_1.OutlookProperties.PR_CREATION_TIME);
47
+ }
48
+ /**
49
+ * Contains the date and time when the object or subobject was last modified.
50
+ * https://msdn.microsoft.com/en-us/library/office/cc815689.aspx
51
+ * @readonly
52
+ * @type {Date}
53
+ * @memberof PSTAttachment
54
+ */
55
+ get modificationTime() {
56
+ return this.getDateItem(OutlookProperties_1.OutlookProperties.PR_LAST_MODIFICATION_TIME);
57
+ }
58
+ /**
59
+ * Get an embedded message.
60
+ * @readonly
61
+ * @type {PSTMessage}
62
+ * @memberof PSTAttachment
63
+ */
64
+ get embeddedPSTMessage() {
65
+ let pstNodeInputStream = null;
66
+ if (this.getIntItem(0x3705) == PSTAttachment.ATTACHMENT_METHOD_EMBEDDED) {
67
+ const item = this.pstTableItems ? this.pstTableItems.get(0x3701) : null;
68
+ if (item && item.entryValueType == 0x0102) {
69
+ if (!item.isExternalValueReference) {
70
+ pstNodeInputStream = new PSTNodeInputStream_class_1.PSTNodeInputStream(this.pstFile, item.data);
71
+ }
72
+ else {
73
+ // We are in trouble!
74
+ throw new Error('PSTAttachment::getEmbeddedPSTMessage External reference in getEmbeddedPSTMessage()!');
75
+ }
76
+ }
77
+ else if (item && item.entryValueType == 0x000d) {
78
+ const descriptorItem = PSTUtil_class_1.PSTUtil.convertLittleEndianBytesToLong(item.data, 0, 4).toNumber();
79
+ const descriptorItemNested = this.localDescriptorItems
80
+ ? this.localDescriptorItems.get(descriptorItem)
81
+ : null;
82
+ if (descriptorItemNested) {
83
+ pstNodeInputStream = new PSTNodeInputStream_class_1.PSTNodeInputStream(this.pstFile, descriptorItemNested);
84
+ if (descriptorItemNested &&
85
+ descriptorItemNested.subNodeOffsetIndexIdentifier > 0) {
86
+ this.localDescriptorItems = this.pstFile.getPSTDescriptorItems(long_1.default.fromNumber(descriptorItemNested.subNodeOffsetIndexIdentifier));
87
+ }
88
+ }
89
+ }
90
+ if (!pstNodeInputStream) {
91
+ return null;
92
+ }
93
+ try {
94
+ const attachmentTable = new PSTTableBC_class_1.PSTTableBC(pstNodeInputStream);
95
+ if (this.localDescriptorItems && this.descriptorIndexNode) {
96
+ return PSTUtil_class_1.PSTUtil.createAppropriatePSTMessageObject(this.pstFile, this.descriptorIndexNode, attachmentTable, this.localDescriptorItems);
97
+ }
98
+ }
99
+ catch (err) {
100
+ console.error('PSTAttachment::embeddedPSTMessage createAppropriatePSTMessageObject failed\n' +
101
+ err);
102
+ throw err;
103
+ }
104
+ }
105
+ return null;
106
+ }
107
+ /**
108
+ * The file input stream.
109
+ * https://msdn.microsoft.com/en-us/library/gg154634(v=winembedded.70).aspx
110
+ * @readonly
111
+ * @type {PSTNodeInputStream}
112
+ * @memberof PSTAttachment
113
+ */
114
+ get fileInputStream() {
115
+ const attachmentDataObject = this.pstTableItems
116
+ ? this.pstTableItems.get(OutlookProperties_1.OutlookProperties.PR_ATTACH_DATA_BIN)
117
+ : null;
118
+ if (!attachmentDataObject) {
119
+ return null;
120
+ }
121
+ else if (attachmentDataObject.isExternalValueReference) {
122
+ const descriptorItemNested = this.localDescriptorItems
123
+ ? this.localDescriptorItems.get(attachmentDataObject.entryValueReference)
124
+ : null;
125
+ if (descriptorItemNested) {
126
+ return new PSTNodeInputStream_class_1.PSTNodeInputStream(this.pstFile, descriptorItemNested);
127
+ }
128
+ }
129
+ else {
130
+ // internal value references are never encrypted
131
+ return new PSTNodeInputStream_class_1.PSTNodeInputStream(this.pstFile, attachmentDataObject.data, false);
132
+ }
133
+ return null;
134
+ }
135
+ /**
136
+ * Size of the attachment file itself.
137
+ * https://msdn.microsoft.com/en-us/library/gg154634(v=winembedded.70).aspx
138
+ * @readonly
139
+ * @type {number}
140
+ * @memberof PSTAttachment
141
+ */
142
+ get filesize() {
143
+ const attachmentDataObject = this.pstTableItems
144
+ ? this.pstTableItems.get(OutlookProperties_1.OutlookProperties.PR_ATTACH_DATA_BIN)
145
+ : null;
146
+ if (attachmentDataObject && attachmentDataObject.isExternalValueReference) {
147
+ const descriptorItemNested = this.localDescriptorItems
148
+ ? this.localDescriptorItems.get(attachmentDataObject.entryValueReference)
149
+ : null;
150
+ if (descriptorItemNested == null) {
151
+ throw new Error('PSTAttachment::filesize missing attachment descriptor item for: ' +
152
+ attachmentDataObject.entryValueReference);
153
+ }
154
+ return descriptorItemNested.dataSize;
155
+ }
156
+ else if (attachmentDataObject) {
157
+ // raw attachment data, right there!
158
+ return attachmentDataObject.data.length;
159
+ }
160
+ return 0;
161
+ }
162
+ /**
163
+ * Contains an attachment's base file name and extension, excluding path.
164
+ * https://msdn.microsoft.com/en-us/library/office/cc842517.aspx
165
+ * @readonly
166
+ * @type {string}
167
+ * @memberof PSTAttachment
168
+ */
169
+ get filename() {
170
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_FILENAME);
171
+ }
172
+ /**
173
+ * Contains a MAPI-defined constant representing the way the contents of an attachment can be accessed.
174
+ * https://msdn.microsoft.com/en-us/library/office/cc815439.aspx
175
+ * @readonly
176
+ * @type {number}
177
+ * @memberof PSTAttachment
178
+ */
179
+ get attachMethod() {
180
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_METHOD);
181
+ }
182
+ /**
183
+ * Contains a number that uniquely identifies the attachment within its parent message.
184
+ * https://msdn.microsoft.com/en-us/library/office/cc841969.aspx
185
+ * @readonly
186
+ * @type {number}
187
+ * @memberof PSTAttachment
188
+ */
189
+ get attachNum() {
190
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_NUM);
191
+ }
192
+ /**
193
+ * Contains an attachment's long filename and extension, excluding path.
194
+ * https://msdn.microsoft.com/en-us/library/office/cc842157.aspx
195
+ * @readonly
196
+ * @type {string}
197
+ * @memberof PSTAttachment
198
+ */
199
+ get longFilename() {
200
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_LONG_FILENAME);
201
+ }
202
+ /**
203
+ * Contains an attachment's fully-qualified path and filename.
204
+ * https://msdn.microsoft.com/en-us/library/office/cc839889.aspx
205
+ * @readonly
206
+ * @type {string}
207
+ * @memberof PSTAttachment
208
+ */
209
+ get pathname() {
210
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_PATHNAME);
211
+ }
212
+ /**
213
+ * Contains an offset, in characters, to use in rendering an attachment within the main message text.
214
+ * https://msdn.microsoft.com/en-us/library/office/cc842381.aspx
215
+ * @readonly
216
+ * @type {number}
217
+ * @memberof PSTAttachment
218
+ */
219
+ get renderingPosition() {
220
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_RENDERING_POSITION);
221
+ }
222
+ /**
223
+ * Contains an attachment's fully-qualified long path and filename.
224
+ * https://msdn.microsoft.com/en-us/library/office/cc815443.aspx
225
+ * @readonly
226
+ * @type {string}
227
+ * @memberof PSTAttachment
228
+ */
229
+ get longPathname() {
230
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_LONG_PATHNAME);
231
+ }
232
+ /**
233
+ * Contains formatting information about a Multipurpose Internet Mail Extensions (MIME) attachment.
234
+ * https://msdn.microsoft.com/en-us/library/office/cc842516.aspx
235
+ * @readonly
236
+ * @type {string}
237
+ * @memberof PSTAttachment
238
+ */
239
+ get mimeTag() {
240
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_MIME_TAG);
241
+ }
242
+ /**
243
+ * Contains the MIME sequence number of a MIME message attachment.
244
+ * https://msdn.microsoft.com/en-us/library/office/cc963256.aspx
245
+ * @readonly
246
+ * @type {number}
247
+ * @memberof PSTAttachment
248
+ */
249
+ get mimeSequence() {
250
+ return this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_MIME_SEQUENCE);
251
+ }
252
+ /**
253
+ * Contains the content identification header of a Multipurpose Internet Mail Extensions (MIME) message attachment.
254
+ * https://msdn.microsoft.com/en-us/library/office/cc765868.aspx
255
+ * @readonly
256
+ * @type {string}
257
+ * @memberof PSTAttachment
258
+ */
259
+ get contentId() {
260
+ return this.getStringItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_CONTENT_ID);
261
+ }
262
+ /**
263
+ * Indicates that this attachment is not available to HTML rendering applications and should be ignored in Multipurpose Internet Mail Extensions (MIME) processing.
264
+ * https://msdn.microsoft.com/en-us/library/office/cc765876.aspx
265
+ * @readonly
266
+ * @type {boolean}
267
+ * @memberof PSTAttachment
268
+ */
269
+ get isAttachmentInvisibleInHtml() {
270
+ const actionFlag = this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_FLAGS);
271
+ return (actionFlag & 0x1) > 0;
272
+ }
273
+ /**
274
+ * Indicates that this attachment is not available to applications rendering in Rich Text Format (RTF) and should be ignored by MAPI.
275
+ * https://msdn.microsoft.com/en-us/library/office/cc765876.aspx
276
+ * @readonly
277
+ * @type {boolean}
278
+ * @memberof PSTAttachment
279
+ */
280
+ get isAttachmentInvisibleInRTF() {
281
+ const actionFlag = this.getIntItem(OutlookProperties_1.OutlookProperties.PR_ATTACH_FLAGS);
282
+ return (actionFlag & 0x2) > 0;
283
+ }
284
+ /**
285
+ * JSON stringify the object properties.
286
+ * @returns {string}
287
+ * @memberof PSTAttachment
288
+ */
289
+ toJSON() {
290
+ const clone = Object.assign({
291
+ size: this.size,
292
+ creationTime: this.creationTime,
293
+ modificationTime: this.modificationTime,
294
+ filename: this.filename,
295
+ attachMethod: this.attachMethod,
296
+ attachNum: this.attachNum,
297
+ longFilename: this.longFilename,
298
+ pathname: this.pathname,
299
+ renderingPosition: this.renderingPosition,
300
+ longPathname: this.longPathname,
301
+ mimeTag: this.mimeTag,
302
+ mimeSequence: this.mimeSequence,
303
+ contentId: this.contentId,
304
+ isAttachmentInvisibleInHtml: this.isAttachmentInvisibleInHtml,
305
+ isAttachmentInvisibleInRTF: this.isAttachmentInvisibleInRTF,
306
+ }, this);
307
+ return clone;
308
+ }
309
+ }
310
+ exports.PSTAttachment = PSTAttachment;
311
+ PSTAttachment.ATTACHMENT_METHOD_NONE = 0;
312
+ PSTAttachment.ATTACHMENT_METHOD_BY_VALUE = 1;
313
+ PSTAttachment.ATTACHMENT_METHOD_BY_REFERENCE = 2;
314
+ PSTAttachment.ATTACHMENT_METHOD_BY_REFERENCE_RESOLVE = 3;
315
+ PSTAttachment.ATTACHMENT_METHOD_BY_REFERENCE_ONLY = 4;
316
+ PSTAttachment.ATTACHMENT_METHOD_EMBEDDED = 5;
317
+ PSTAttachment.ATTACHMENT_METHOD_OLE = 6;