OptionalansiOptionalconvertOtherwise, you can provide your own converter (from ansiString to unicode string).
OptionalprovideProvide your own optional type converter.
This provider is to provide a fallback type converter for unresolved types.
A numeric like 0x1002
A valid PrimitiveTypeConverter; otherwise,
return undefined to indicate to find another type converter.
OptionalprovideProvide your own optional type converter.
About known types, check:
A type converter is resolved in this order:
provideTypeConverterOf (called if provided. return undefined to go next resolver)typeConverters (built-in type converters)provideFallbackTypeConverterOf (called if provided. return undefined to go next resolver)throw new Error(...);A numeric like 0x1002
A valid PrimitiveTypeConverter; otherwise,
return undefined to indicate to find another type converter.
const pst = openPstFile(
'path/to/file.pst',
{
provideTypeConverterOf: (propertyType) => {
if (propertyType === 0x1002) {
return async (arg) => {
const heap = arg.view.getUint32(0, true);
const list = [] as any[];
if (heap !== 0) {
const bytes = await arg.resolveHeap(heap);
if (bytes !== undefined) {
const view = new DataView(bytes);
const count = bytes.byteLength / 2;
for (let x = 0; x < count; x++) {
list.push(view.getInt16(2 * x, true))
}
}
}
return list;
};
}
return undefined;
},
}
);
Specify character encoding usable with TextDecoder.
This is used to obtain unicode string from ArrayBuffer of ansiString PT_STRING8.
It is rare case that pst/ost files store ansiString, because recent Outlook applications are Unicode based.
This applies to pst files generated by older versions of Outlook.
And ansiEncoding is required because ANSI code page depends on Windows's system locale can be acquired by GetOEMCP API.
OEMCP cannot be obtained from pure JavaScript environment, especially on Web browser environment. Thus you need to specify considered one.