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

@napolux/simple-reading-time

v0.2.0

Published

TypeScript utility to estimate reading time of plain text, HTML, and Markdown content

Readme

@napolux/simple-reading-time

A lightweight TypeScript utility to estimate the reading time of plain text, HTML, and Markdown content.

Installation

npm install @napolux/simple-reading-time
yarn add @napolux/simple-reading-time

Usage

import { readingTime } from "@napolux/simple-reading-time";

Plain text

const result = readingTime("some plain text");
// => { minutes: 1, seconds: 1, words: 3, text: "1 min. read" }

HTML

const result = readingTime("<p>some html</p>", { format: "html" });
// => { minutes: 1, seconds: 1, words: 2, text: "1 min. read" }

Markdown

const result = readingTime("## some markdown", { format: "markdown" });
// => { minutes: 1, seconds: 1, words: 2, text: "1 min. read" }

Custom reading speed

const result = readingTime("some text", { wordsPerMinute: 250 });
// => { minutes: 1, seconds: 0, words: 2, text: "1 min. read" }

Localized output

readingTime("du texte en francais", { locale: "fr_FR" });
// => { minutes: 1, seconds: 1, words: 4, text: "1 min de lecture" }

readingTime("un testo in italiano", { locale: "it_IT" });
// => { minutes: 1, seconds: 1, words: 4, text: "1 min. di lettura" }

readingTime("ein deutscher Text", { locale: "de_DE" });
// => { minutes: 1, seconds: 1, words: 3, text: "1 Min. Lesezeit" }

readingTime("un texto en espanol", { locale: "es_ES" });
// => { minutes: 1, seconds: 1, words: 4, text: "1 min. de lectura" }

Next.js blog post component

import { readingTime } from "@napolux/simple-reading-time";

interface BlogPostProps {
  title: string;
  content: string;
}

export default function BlogPost({ title, content }: BlogPostProps) {
  const { text } = readingTime(content, { format: "html" });

  return (
    <article>
      <h1>{title}</h1>
      <span>{text}</span>
      <div dangerouslySetInnerHTML={{ __html: content }} />
    </article>
  );
}

API

readingTime(text: string, options?: ReadingTimeOptions): ReadingTimeResult

| Parameter | Type | Default | Description | | ------------------------ | ------------------------------------- | --------- | ---------------------------------- | | text | string | - | The content to analyze. | | options.wordsPerMinute | number | 260 | Reading speed in words per minute. | | options.format | "plain" | "html" | "markdown" | "plain" | Content format for preprocessing. | | options.locale | SupportedLocale | "en_US" | Locale for the text field. |

ReadingTimeResult

| Property | Type | Description | | --------- | -------- | --------------------------------------------- | | minutes | number | Estimated reading time (rounded up, minutes). | | seconds | number | Estimated reading time in total seconds. | | words | number | Total word count after preprocessing. | | text | string | Human-readable string, e.g. "3 min. read". |

DEFAULT_WORDS_PER_MINUTE

Exported constant equal to 260.

SupportedLocale

Union type of supported locale codes:

| Locale | Language | Example output | | --------- | -------- | --------------------- | | "en_US" | English | "3 min. read" | | "it_IT" | Italian | "3 min. di lettura" | | "fr_FR" | French | "3 min de lecture" | | "de_DE" | German | "3 Min. Lesezeit" | | "es_ES" | Spanish | "3 min. de lectura" |

Works everywhere

  • TypeScript - full literal types, autocomplete, and type safety
  • JavaScript (ESM) - import { readingTime } from "@napolux/simple-reading-time"
  • JavaScript (CJS) - const { readingTime } = require("@napolux/simple-reading-time")
  • Node.js - works out of the box, CJS and ESM

Why 260 words per minute?

The default of 260 words per minute is based on the meta-analysis by Marc Brysbaert (2019), "How many words do we read per minute? A review and meta-analysis of reading rate". Popular platforms like Medium use 275 wpm. Use the wordsPerMinute option to tune this to your audience.

License

MIT