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

@f1anderz/msg-parser

v0.1.4

Published

TypeScript library to parse and preview Outlook .msg files. No DOM required.

Readme

msg-parser

TypeScript library to parse Outlook .msg files to HTML string. Files are parsed locally — nothing is uploaded. Runs in the browser, Node, and React Native — no DOM required.

Install

Published to GitHub Packages under the @f1anderz scope. Point the scope at the GitHub registry once (project .npmrc), then install normally:

# .npmrc
@f1anderz:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
npm install @f1anderz/msg-parser

GITHUB_TOKEN needs read:packages scope. Installs ship the prebuilt, minified dist/ (no source, no build step).

Usage

One-liner for a file input (the common case)

import { renderMsgFile } from '@f1anderz/msg-parser';

input.addEventListener('change', async () => {
  const html = await renderMsgFile(input.files[0]);
  iframe.setAttribute('sandbox', ''); // no allow-scripts — this is the security boundary
  iframe.srcdoc = html;
});

Parse to structured data

import { parseMsg } from '@f1anderz/msg-parser';

const msg = parseMsg(await file.arrayBuffer());
// { subject, senderName, senderEmail, date, recipients, bodyHtml, bodyText, attachments, ... }

Render a parsed message

import { renderToHtml } from '@f1anderz/msg-parser';
const html = renderToHtml(msg, { locale: 'uk-UA', blockRemoteImages: true });

API

| Export | Signature | | --------------- | ------------------------------------------------------------------------------------------------ | | parseMsg | (input: ArrayBuffer \| Uint8Array) => MsgMessage | | renderToHtml | (input: MsgMessage \| ArrayBuffer \| Uint8Array, options?: RenderOptions) => string | | renderMsgFile | (input: File \| Blob \| ArrayBuffer \| Uint8Array, options?: RenderOptions) => Promise<string> | | decompressRtf | (bytes: Uint8Array) => Uint8Array \| null |

RenderOptions: locale, formatDate, showHiddenAttachments, inlineImages, blockRemoteImages, fragment, sanitize.

sanitize?: (html: string) => string replaces the built-in sanitizer. It receives the raw body HTML before cid: substitution, and fully overrides sanitization — blockRemoteImages included.

parseMsg (and therefore renderToHtml/renderMsgFile) throws InvalidMsgError when given a buffer that isn't a valid .msg (missing OLE Compound File signature) or is otherwise corrupt.

renderMsgFile's File/Blob overload types require the DOM lib (or @types/node's DOM-ish globals) to be available in the consumer's TypeScript config; browser app configs already include this by default.

Security

renderToHtml output is intended to be rendered inside a sandboxed iframe without allow-scripts — that is the real security boundary. In React Native, the equivalent is react-native-webview with javaScriptEnabled={false}. If you render this HTML in a WebView with JavaScript enabled, the sanitizer becomes your only boundary rather than defense-in-depth.

As defense-in-depth, message HTML is sanitized with xss against an allowlist tuned for email: <script>, <iframe>, <form>, <svg>, on*= handlers, javascript: URLs, and CSS expression()/url(javascript:) are removed, while the tables, inline styles, class attributes and <style> blocks real messages depend on are preserved. Sanitization needs no DOM, so it behaves identically in the browser, Node, and React Native.

Set blockRemoteImages: true to neutralize remote resources: http(s) and protocol-relative URLs in src, srcset, background, and poster attributes, and in CSS url(...) inside inline style attributes. It does not reach stylesheet contents inside <style> blocks, nor <link> or @import — pass your own sanitize if you need that.

Scope

Parses: headers, sender, recipients (To/Cc/Bcc), date, plain-text and HTML bodies (including HTML recovered from compressed RTF), attachments, and inline cid: images. Not yet supported: embedded .msg attachments and exotic ANSI codepage switching.

Tooling versions

@eslint/js 10.0.1
@vitest/coverage-v8 4.1.10
eslint 10.7.0
prettier 3.9.6
tsup 8.5.1
typescript 5.9.3
typescript-eslint 8.65.0
vitest 4.1.10

Note on the typescript pin: typescript is pinned to 5.9.3 rather than the latest 7.x line because TypeScript 7.x is not yet compatible with typescript-eslint's peer version range and broke tsup's .d.ts build. Re-evaluate this pin once typescript-eslint and tsup publish support for TypeScript 7.

License

MIT