# reading-time

> Medium's like reading time estimation.

Latest version **1.5.0** (published 2021-09-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install reading-time
pnpm add reading-time
yarn add reading-time
bun add reading-time
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.0 |
| Published | 2021-09-10 |
| First published | 2014-03-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1429 |
| Author | Nicolas Gryman |
| Maintainers | ngryman |
| Keywords | read, time, read time, reading time, medium, words per minute |

## Links

- npm: https://www.npmjs.com/package/reading-time
- Repository: https://github.com/ngryman/reading-time
- Homepage: https://github.com/ngryman/reading-time#readme
- Issues: https://github.com/ngryman/reading-time/issues
- npm.io page: https://npm.io/package/reading-time

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 1.5.0 (latest) — 2021-09-10
- 2.0.0-1 (beta) — 2021-10-19
- 2.0.0-0 — 2021-10-12
- 1.4.0 — 2021-08-14
- 1.3.0 — 2021-01-28
- 1.2.1 — 2020-11-20
- 1.2.0 — 2019-04-11
- 1.1.3 — 2018-07-01
- 1.1.2 — 2018-06-02
- 1.1.1 — 2018-05-03
- 1.1.0 — 2016-05-24
- 1.0.2 — 2016-01-13
- 0.1.0 — 2015-07-11
- 0.0.1 — 2014-03-21

## README

# reading-time

[![NPM](http://img.shields.io/npm/v/reading-time.svg)](https://www.npmjs.org/package/reading-time) [![Build Status](http://img.shields.io/travis/ngryman/reading-time.svg)](https://travis-ci.org/ngryman/reading-time)

<br>

[Medium]'s like reading time estimation.

`reading-time` helps you estimate how long an article will take to read.
It works perfectly with plain text, but also with `markdown` or `html`.

Note that it's focused on performance and simplicity, so the number of words it will extract from other formats than plain text can vary a little. But this is an estimation right?

[medium]: https://medium.com

## Installation

```sh
npm install reading-time --production
```

## Usage

### Classic

```javascript
const readingTime = require('reading-time');

const stats = readingTime(text);
// ->
// stats: {
//   text: '1 min read',
//   minutes: 1,
//   time: 60000,
//   words: 200
// }
```

### Stream

```javascript
const {readingTimeStream} = require('reading-time');

fs.createReadStream('foo')
  .pipe(readingTimeStream)
  .on('data', stats => {
    // ...
  });
```

## API

`readingTime(text, options?)`

- `text`: the text to analyze
- options (optional)
  - `options.wordsPerMinute`: (optional) the words per minute an average reader can read (default: 200)
  - `options.wordBound`: (optional) a function that returns a boolean value depending on if a character is considered as a word bound (default: spaces, new lines and tabulations)

## Help wanted!

This library has been optimized for alphabetical languages and CJK languages, but may not behave correctly for other languages that don't use spaces for work bounds. If you find the behavior of this library to deviate significantly from your expectation, issues or contributions are welcomed!

## Other projects

- [Fauda](https://github.com/ngryman/fauda): configuration made simple.
- [Badge Size](https://github.com/ngryman/badge-size): Displays the size of a given file in your repository.
- [Commitizen Emoji](https://github.com/ngryman/cz-emoji): Commitizen adapter formatting commit messages using emojis.

---
_Source: https://npm.io/package/reading-time · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
