The most comprehensive TypeScript library for parsing email archives and extracting valuable insights.
π Intelligent Detection β’ π§ Multi-Format Support β’ β‘ Memory Efficient β’ π Cross-Platform
Installation β’ Quick Start β’ Use Cases β’ API Reference
Email Archive Parser is a powerful, modern TypeScript library that goes beyond simple email parsing. It intelligently analyzes your email archives to extract:
- OLM Files - Outlook for Mac archives (
.olm) with contacts & calendar events - MBOX Files - Gmail Takeout, Thunderbird, Apple Mail (
.mbox) - Unlimited File Sizes - Stream processing handles multi-GB files (tested with 2.4GB+)
- Gmail Labels - Automatic label extraction (Inbox, Starred, Categories, etc.)
- Contact Extraction - Automatically builds contact list from email senders
- MIME Support - Parse multipart emails, attachments, HTML content
- π Account Detection - 100+ services (Netflix, GitHub, Amazon, etc.)
- π Purchase Detection - Orders, receipts, invoices with multi-currency support
- π Subscription Detection - Recurring services, billing cycles, renewal dates
- π° Newsletter Detection - Newsletters, promotional emails, frequency analysis
- Smart Categorization - Automatically classify emails by type
- Financial Tracking - Sum purchases, identify spending patterns
- Service Inventory - Complete list of accounts and subscriptions
- Email Statistics - Read/unread status, folder distribution, sender analysis
- Memory Efficient - Stream processing for large files
- Cross-Platform - Node.js and browser environments
- TypeScript First - Full type safety and IntelliSense
- Minimal Dependencies - Only jszip for archive extraction
- Local Processing - All analysis happens on your device
- No Data Transmission - Emails never leave your computer
- Open Source - Transparent, auditable code
npm install @technical-1/email-archive-parseryarn add @technical-1/email-archive-parserpnpm add @technical-1/email-archive-parserThe /examples directory contains ready-to-use code samples:
| Example | Description |
|---|---|
react-demo/ |
Complete React app - Lift and shift into your project! |
quick-start-react.tsx |
Simple React component for quick integration |
basic-usage.ts |
General usage patterns for both formats |
olm-usage.ts |
Outlook-specific features |
mbox-usage.ts |
Gmail-specific features |
with-detectors.ts |
Detection examples |
A complete React application with IndexedDB storage that handles files of any size:
cd examples/react-demo
npm install
npm run devFeatures:
- π§ Parse OLM and MBOX files of any size
- πΎ IndexedDB storage (no memory limits)
- π Search and pagination
- π¬ Email detail view
- π₯ Contacts list
- π Calendar events
- ποΈ Clear data button
- π¨ Tailwind CSS styling
Copy the src/ folder into your React project to use!
React / Next.js / Vite:
import { parseArchive } from '@technical-1/email-archive-parser';
// In your component:
const handleUpload = async (e) => {
const file = e.target.files[0];
const result = await parseArchive(file);
console.log(result.emails); // Your emails!
};
return <input type="file" accept=".olm,.mbox" onChange={handleUpload} />;Vanilla JavaScript:
<input type="file" id="upload" accept=".olm,.mbox">
<script type="module">
import { parseArchive } from '@technical-1/email-archive-parser';
document.getElementById('upload').onchange = async (e) => {
const result = await parseArchive(e.target.files[0]);
console.log(result.emails); // Your emails!
};
</script>Node.js (for any file size):
import { MBOXParser, OLMParser } from '@technical-1/email-archive-parser';
// Parse a 5GB MBOX file with streaming - no memory issues!
const parser = new MBOXParser();
const result = await parser.parseFile('/path/to/huge-archive.mbox');
console.log(result.emails);For production web applications, check out our complete React implementation in examples/react-demo/. It includes:
- β IndexedDB storage - Handles files of any size without memory issues
- β Streaming parsing - Saves to database during parsing, not after
- β Ready-to-use components - EmailList, EmailDetail, ContactList, CalendarList
- β
Custom React hook -
useEmailDBfor all database operations - β Tailwind CSS styling - Modern, responsive UI
# Try it out
cd examples/react-demo
npm install
npm run devLift and shift the src/ folder into your own React/Next.js/Vite project!
For detailed API documentation, advanced examples, and use cases, see API.md.
| File Size | Memory Usage | Processing Time | Method |
|---|---|---|---|
| < 20MB | Normal | < 5 seconds | Standard parsing |
| 20MB - 500MB | Moderate | 10-60 seconds | Standard parsing |
| 500MB - 2GB | Low | 1-5 minutes | Streaming parsing |
| > 2GB | Very Low | 5+ minutes | Streaming parsing |
| Detector | Precision | Recall | Sample Size |
|---|---|---|---|
| Accounts | 92% | 88% | 1,000+ emails |
| Purchases | 94% | 91% | 500+ transactions |
| Subscriptions | 89% | 95% | 200+ services |
| Newsletters | 96% | 87% | 800+ emails |
| Format | Extensions | Source | Features |
|---|---|---|---|
| OLM | .olm |
Outlook for Mac | Full support: emails, contacts, calendar |
| MBOX | .mbox |
Gmail Takeout | Full support + Gmail labels |
| MBOX | .mbox |
Thunderbird | Full support + folder structure |
| MBOX | .mbox |
Apple Mail | Full support |
| MBOX | .mbx |
Various clients | Basic support |
- β Plain Text emails
- β HTML emails with content extraction
- β MIME Multipart (text + HTML + attachments)
- β Quoted-Printable encoding
- β Base64 encoding
- β UTF-8 and international character sets
- β File Attachments (metadata extraction)
- β Email Threads (conversation grouping)
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run dev
# Run tests
npm testThis library processes all data locally. No email content is ever sent to external servers.
MIT License - see LICENSE for details.
- Built with TypeScript
- Archive extraction powered by JSZip
- Bundled with tsup
Made by Jacob Kanfer