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 🙏

© 2024 – Pkg Stats / Ryan Hefner

eml-analyzer

v1.0.2

Published

A tool to analyse the HTML version of an email message in `.eml` files.

Downloads

25

Readme

eml-analyzer

A tool to analyse the HTML version of an email message in .eml files.

Install

npm i eml-analyzer

Usage

import * as fs from "fs";
import emlAnalyzer from "eml-analyzer";

let analyzer = new emlAnalyzer("path/to/file.eml");

analyzer.run().then(() => {
  let result = analyzer.result;

  // print result to console
  console.log(result);

  // or save as JSON
  fs.writeFileSync(`results.json`, JSON.stringify(result, null, 2));
});

Options

| Option | Type | Default | Description | | ----------------------- | ------- | ------- | ----------------------------------------------- | | fetchExternalAssetsSize | Boolean | false | Whether to get the file size of external assets |

let analyzer = new emlAnalyzer("path/to/file.eml", {
  fetchExternalAssetsSize: false,
});

Results

The returned results include:

  • Size (in bytes)
    • of the .eml file
    • of each MIME type
  • MIME Types
  • Subject line
    • Character count
    • Word count
    • Used emojis
  • Sender
    • The TLD of sender domain
    • Subdomain
  • Whether the email has attachements
  • Language of email message
  • HTML
    • Tags
    • Tag attributes
    • MSO conditional comments
    • URL protocols used in links
    • Structured data
      • Whether structured data is used (e.g. Gmail annotations)
      • Whether Microsoft Actionable Messages are used
  • CSS
    • Whether invalid CSS is detected
    • CSS properties
    • CSS values
    • CSS selectors
    • CSS rules
    • CSS at-rules
  • External assets
    • Image count
    • File formats
    • Optional: file sizes of external assets (in bytes)
{
  "size": {
    "eml": 111062,
    "text": 4059,
    "html": 96074,
    "amp": 0
  },
  "mimeTypes": {
    "text": true,
    "html": true,
    "amp": false
  },
  "subject": {
    "chars": 25,
    "words": 4,
    "emojis": [
      "❤️‍🔥"
    ]
  },
  "sender": {
    "tld": "com",
    "subdomain": "",
    "government": false,
    "education": false
  },
  "hasAttachments": false,
  "language": {
    "code": "arb",
    "name": "Standard Arabic"
  },
  "html": {
    "urlProtocols": [
      "https:"
    ],
    "tags": {
      "meta": {
        "count": 5
      },
      "title": {
        "count": 1
      },
      "style": {
        "count": 1
      },
      "center": {
        "count": 1
      },
      "table": {
        "count": 5
      },
      "tbody": {
        "count": 5
      },
      "tr": {
        "count": 19
      },
      "td": {
        "count": 22
      },
      "div": {
        "count": 22
      },
      .
      .
      .
    },
    "attributes": [
      "charset",
      "http-equiv",
      "content",
      "name",
      "type",
      "align",
      "border",
      "cellpadding",
      "cellspacing",
      "height",
      "width",
      "id",
      "style",
      .
      .
      .
    ],
    "conditionalComments": [
      "[if gte mso 9]"
    ],
    "hasStructuredData": false,
    "hasMicrosoftActionableMessage": false
  },
  "css": {
    "hasInvalid": false,
    "properties": [
      "direction",
      "border-collapse",
      "mso-table-lspace",
      "mso-table-rspace",
      "-ms-text-size-adjust",
      "-webkit-text-size-adjust",
      "height",
      "margin",
      "padding",
      "width",
      .
      .
      .
    ],
    "values": [
      "rtl",
      "collapse",
      "0",
      "100%",
      "exactly",
      "9px",
      "separate",
      "0.5px solid #6E6E6E",
      "10px",
      "#FFF",
      "600px",
      "none no-repeat center/cover",
      .
      .
      .
    ],
    "selectors": [
      ":root",
      "img",
      "html",
      "body",
      ".gray-box",
      ".upper-footer",
      ".lower-footer",
      "body,#mainBody",
      "p,li,.main-content h5",
      .
      .
      .
    ],
    "rules": [
      {
        "property": "direction",
        "value": "rtl"
      },
      {
        "property": "border-collapse",
        "value": "collapse"
      },
      {
        "property": "mso-table-lspace",
        "value": "0"
      },
      {
        "property": "height",
        "value": "100%"
      },
      .
      .
      .
    ],
    "atRules": [
      {
        "name": "font-face",
        "params": ""
      },
      {
        "name": "media",
        "params": "(prefers-color-scheme: dark)"
      },
      {
        "name": "media",
        "params": "only screen and (max-width: 480px)"
      }
    ]
  },
  "externalAssets": {
    "imageCount": 15,
    "formats": [
      ".png",
      ".jpeg"
    ],
    "sizes": []
  }
}

License

MIT Licensed, see License.md

Credit

Parts of the code has been adopted form other EMC projects and were written by other developers not listed in this repository as contributors.