MSG Reader TS
MSG Reader is an Outlook Item File (.msg) reader that is built with HTML5.
Allows to parse and extract necessary information (attachment included) from .msg file.
Based on original TypeScript conversion from here
Online demo
Angular service example
import { Injectable } from '@angular/core';
import * as MsgReader from '@sharpenednoodles/msg.reader-ts';
import { MSGFileData } from '@sharpenednoodles/msg.reader-ts';
import { Observable, of } from 'rxjs';
export class MsgParserService {
constructor() { }
parseMsg(msgFile: File): Observable<MSGFileData> {
const fileReader = new FileReader();
fileReader.readAsArrayBuffer(msgFile);
return new Observable((observer) => {
fileReader.onload = (e: ProgressEvent): void => {
let bytes = new Uint8Array((<any>e.target).result);
const msgReader = new MsgReader.MSGReader(bytes);
const msg = msgReader.getFileData();
if (msg['error']) { observer.error(msg['error']); }
observer.next(msg as MSGFileData);
observer.complete();
}
fileReader.onerror = (error: ProgressEvent): void => {
observer.error(error);
}
});
}
}
Fork
This project was orignally forked from: