npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@orkestrel/msg

v0.0.8

Published

A zero-dependency Outlook .msg (CFB/OLE2) and .eml (RFC 2822/MIME) email parser — extracts headers, bodies, recipients, and attachments into typed structures, with .msg round-trip rebuild. Part of the @orkestrel line.

Readme

@orkestrel/msg

A zero-dependency Outlook .msg (CFB/OLE2) and .eml (RFC 2822/MIME) email parser — extracts headers, bodies, recipients, and attachments into typed structures. Feed it raw file bytes plus an optional file name or MIME hint; the format is detected automatically and the file is parsed into a structured EmailChain — sender, recipients, subject, date, text/HTML bodies, and decoded attachments. .msg files are read via a from-scratch CFB (Compound File Binary / OLE2) parser that walks the directory tree and extracts MAPI properties directly; .eml files are read via a from-scratch RFC 2822/MIME parser that walks the header block and the (possibly nested) MIME part tree. createMSG surfaces every parse failure as a Failure<MSGError> inside a Result rather than throwing it; an unexpected non-MSGError error still propagates by throwing. Part of the @orkestrel line.

Install

npm install @orkestrel/msg

Requirements

  • Node.js >= 22
  • ESM + CJS (dual-format build)
  • No runtime dependencies

Usage

import { createMSG, isSuccess } from '@orkestrel/msg'

const result = createMSG({ bytes, name: 'message.msg' }) // bytes: Uint8Array

if (isSuccess(result)) {
	const msg = result.value
	console.log(msg.chain.format) // 'msg' or 'eml'

	const message = msg.chain.messages[0]
	console.log(message.from, message.to, message.subject)
	console.log(message.text) // plain-text body (includes quoted reply chain)
	console.log(message.html) // HTML body (includes quoted reply chain)

	for (const attachment of message.attachments) {
		console.log(attachment.name, attachment.mimeType, attachment.size)
	}

	console.log(msg.fields) // MSGFieldData | undefined (undefined for 'eml')
	const rebuilt = msg.burn() // round-trip back into a CFB byte stream
	const embedded = msg.attachment(0) // extract an embedded .msg attachment
} else {
	console.error(result.error.code, result.error.message) // 'UNSUPPORTED' | 'MALFORMED' | ...
}

createMSG is synchronous and returns a Result<MSGInterface, MSGError>; every parse failure surfaces as a Failure<MSGError> rather than a throw (an unexpected non-MSGError error still propagates). Format is inferred from the name / mime hints when supplied. When they are absent, raw Uint8Array/ArrayBuffer input is always parsed as .msg; an EmailInput with no hints is sniffed for the CFB magic header and parsed as .msg on a match, .eml otherwise. The underlying MSG class (new MSG(...)) parses eagerly and throws MSGError on malformed or unsupported input — use createMSG for the non-throwing Result form.

Guide

For the full surface — the MSG class, its supporting types (EmailChain, EmailMessage, EmailAttachment, MSGDirectoryEntry, and friends), and the CFB/MIME formats it implements — see guides/src/msg.md.

Package

Published as a single typed entry point per the exports field in package.json.

License

MIT © Orkestrel — see LICENSE.