@kenjiuno/msgreader
Advanced tools
Comparing version 1.12.0-alpha.3 to 1.12.0-alpha.4
@@ -10,2 +10,22 @@ export interface ParserConfig { | ||
includeRawProps?: boolean; | ||
/** | ||
* Specify iconv-lite's supported character encoding. | ||
* This is used for PT_STRING8 (PtypString8) non-Unicode string properties. | ||
* | ||
* e.g. | ||
* | ||
* - `null` | ||
* - windows-1251 | ||
* - `windows1251` | ||
* - `1251` | ||
* - `win1251` | ||
* - `cp1251` | ||
* - Windows-31J | ||
* - `shiftjis` | ||
* - `932` | ||
* - `ms932` | ||
* - `cp932` | ||
* | ||
*/ | ||
ansiEncoding?: string; | ||
} | ||
@@ -12,0 +32,0 @@ /** |
@@ -54,3 +54,3 @@ "use strict"; | ||
} | ||
MsgReader.prototype.decodeField = function (fieldClass, fieldType, provider, insideProps) { | ||
MsgReader.prototype.decodeField = function (fieldClass, fieldType, provider, ansiEncoding, insideProps) { | ||
var array = provider(); | ||
@@ -96,3 +96,3 @@ var ds = new DataStream_1.default(array, 0, DataStream_1.default.LITTLE_ENDIAN); | ||
else if (decodeAs === "string") { | ||
value = ds.readString(array.length); | ||
value = ds.readString(array.length, ansiEncoding); | ||
skip = insideProps; | ||
@@ -156,3 +156,3 @@ } | ||
else { | ||
this.setDecodedFieldTo(parserConfig, fields, this.decodeField(fieldClass, fieldType, documentProperty.provider, false)); | ||
this.setDecodedFieldTo(parserConfig, fields, this.decodeField(fieldClass, fieldType, documentProperty.provider, parserConfig.ansiEncoding, false)); | ||
} | ||
@@ -299,3 +299,3 @@ }; | ||
parserConfig.propertyObserver(fields, propertyTag, raw); | ||
this_1.setDecodedFieldTo(parserConfig, fields, this_1.decodeField(fieldClass, fieldType, function () { return raw; }, true)); | ||
this_1.setDecodedFieldTo(parserConfig, fields, this_1.decodeField(fieldClass, fieldType, function () { return raw; }, parserConfig.ansiEncoding, true)); | ||
}; | ||
@@ -330,3 +330,3 @@ var this_1 = this; | ||
var fieldType = (0, utils_1.toHex2)(propertyTag & 0xFFFF); | ||
this_2.setDecodedFieldTo(parserConfig, fields, this_2.decodeField(fieldClass, fieldType, function () { return arr; }, true)); | ||
this_2.setDecodedFieldTo(parserConfig, fields, this_2.decodeField(fieldClass, fieldType, function () { return arr; }, parserConfig.ansiEncoding, true)); | ||
}; | ||
@@ -431,3 +431,3 @@ var this_2 = this; | ||
MsgReader.prototype.getFileData = function () { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
if (this.fieldsData === undefined) { | ||
@@ -444,3 +444,4 @@ if (!this.reader.isMSGFile()) { | ||
propertyObserver: ((_a = this.parserConfig) === null || _a === void 0 ? void 0 : _a.propertyObserver) || (function () { }), | ||
includeRawProps: (_b = this.parserConfig) === null || _b === void 0 ? void 0 : _b.includeRawProps, | ||
includeRawProps: ((_b = this.parserConfig) === null || _b === void 0 ? void 0 : _b.includeRawProps) ? true : false, | ||
ansiEncoding: (_c = this.parserConfig) === null || _c === void 0 ? void 0 : _c.ansiEncoding, | ||
}); | ||
@@ -447,0 +448,0 @@ } |
{ | ||
"name": "@kenjiuno/msgreader", | ||
"version": "1.12.0-alpha.3", | ||
"version": "1.12.0-alpha.4", | ||
"description": "Outlook Item File (.msg) reader in JavaScript Npm Module", | ||
@@ -13,4 +13,3 @@ "main": "lib/index.js", | ||
"mocha": "set NODE_ENV=test && mocha", | ||
"dr": "npm publish --dry-run", | ||
"p": "npm publish" | ||
"dr": "npm publish --dry-run" | ||
}, | ||
@@ -17,0 +16,0 @@ "author": "kenjiuno", |
@@ -16,3 +16,3 @@ # msgreader | ||
Links: [_typedoc documentation_](https://hiraokahypertools.github.io/msgreader/typedoc/) | [_demo_](https://hiraokahypertools.github.io/msgreader_demo/) | ||
Links: [_typedoc documentation_](https://hiraokahypertools.github.io/msgreader/typedoc/) | [_online demo_](https://hiraokahypertools.github.io/msgreader_demo/) | ||
@@ -19,0 +19,0 @@ ## How to use |
260339
7504