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

eml2pdf

v1.0.0

Published

eml2pdf is a CLI tool that converts .eml email files to PDF format, featuring customezed file naming based on email date and subject, and optional PDF merging.

Downloads

11

Readme

eml2pdf

eml2pdf is a command-line utility that converts .eml email files to PDF format. It processes either a single .eml file or all .eml files in a specified input directory, converts each email to an individual PDF file (prefixed with the email's date and subject), and optionally merges them into a single PDF sorted by date (oldest to newest).

Features

  • Convert Emails to PDF:
    Converts each .eml file into a PDF using mailparser and puppeteer.

  • Custom File Naming:
    Each PDF is named in the format: YYYY-MM-DD Subject.pdf where the date is derived from the email and the subject is sanitized for safe filenames.

  • Optional PDF Merging:
    Merge all individual PDFs into one combined PDF (sorted by date) using pdf-lib.

  • Simple CLI Interface:
    Easily install and run the utility from the command line.

Installation

To install eml2pdf globally via npm, run:

npm install -g eml2pdf

This installs the command-line tool so you can run eml2pdf from anywhere.

Usage

The basic command-line usage is:

eml2pdf <input_directory|input_file> <output_directory> [combined_pdf_filename]

  • <input_directory|input file>: Path to single .eml file a directory containing multiple .eml files.
  • <output_directory>: Directory where the generated PDF files will be saved.
  • [combined_pdf_filename] (optional): If provided, after converting individual emails, the tool will merge them into a single PDF with this name. If the filename does not end with .pdf, the extension will be appended automatically.

Examples

Convert single .eml file to a PDF

eml2pdf /path/to/eml/file.eml /path/to/output

Convert .eml files to individual PDFs

eml2pdf /path/to/eml/files /path/to/output

Convert and Merge into a Single PDF

eml2pdf /path/to/eml/files /path/to/output all_emails.pdf

In the above example, the tool converts each .eml file into a PDF named with its date and subject, and then merges them into a file named all_emails.pdf sorted from oldest to newest.

How It Works

  1. Email Parsing: The utility reads each .eml file and uses mailparser to extract email content, including the date and subject.
  2. PDF Generation: The email content is rendered as HTML and converted into a PDF (A4 format) using puppeteer.
  3. File Naming: Each PDF file is named in the format YYYY-MM-DD Subject.pdf, where the date is in the YYYY-MM-DD format and the subject is sanitized for use in file names.
  4. PDF Merging: If a combined PDF filename is provided, the tool sorts the individual PDFs by the date (oldest to newest) and merges them into a single document using pdf-lib.

Requirements

  • Node.js: Version 14 or later is recommended.
  • npm: Comes with Node.js.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please fork the repository and submit pull requests with your improvements or bug fixes. If you encounter any issues, feel free to open an issue on GitHub.