Skip to content

anzerr/read.estimate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intro

GitHub Actions status | linter GitHub Actions status | publish GitHub Actions status | test

Medium's like reading time estimation.

Install

npm install --save git+https://git@github.com/anzerr/read.estimate.git
npm install --save @anzerr/read.estimate

Example

const estimate = require('read.estimate'),
	fs = require('fs');

const out = estimate(fs.readFileSync('./README.md').toString(), {
	strip: true,
	wpm: 225, // WORDS_PER_MIN
	ipm: 6, // IMAGE_PER_MIN
	scale: 1,
	pad: 0.25
});

console.log(out);
/*
{
	count: { words: 84, images: 3 },
	time: { words: 0.37333333333333335, images: 0.5 },
	minutes: 0.8733333333333333,
	text: '1 minutes'
}
*/