Convert Mbox to js object
npm install mbox-parsermbox-tparser is a really simple package to transform mbox files to js object.
``sh`
yarn add mbox-parseror
npm install mbox-parser
Get all mails in a mbox file
`typescript
import { mboxParser } from "mbox-parser";
// here stream is a ReadStream to your mbox file
mboxParser(stream).then((mails) => {
console.log(mails);
});
`
Get a specific page of a specific size in your mbox file
> First page is at number 1
`typescript
import { mboxParser } from "mbox-parser";
// here stream is a ReadStream to your mbox file
mboxParser(stream, {
pageSize: 20, // Number of mail to return
pageNumber: 4 // Index of the 'page' you want
}).then((mails) => {
console.log(mails);
});
}
``