Skip to content

edoardottt/go-readingtime

Repository files navigation

go-readingtime

Estimate how long it takes to read a text

Coded with 💙 by edoardottt

go action go report card

InstallUsageChangelogContributingLicense

Install 📡

go install github.com/edoardottt/go-readingtime/cmd/readt@latest

Usage 💡

CLI tool

readt <filepath>

Golang module

package main

import (
 "fmt"

 reading "github.com/edoardottt/go-readingtime"
)

func main() {
 s := reading.RawEstimate(`Lorem ipsum dolor sit amet, consectetur...`)
 fmt.Println(s) // 130

 d := reading.Estimate(`Lorem ipsum dolor sit amet, consectetur...`)
 fmt.Println(d) // 2m10s

 h := reading.HumanEstimate(`Lorem ipsum dolor sit amet, consectetur...`)
 fmt.Println(h) // 2 minutes
}

Read the package documentation here.

Changelog 📌

Detailed changes for each release are documented in the release notes.

Contributing 🛠

Just open an issue / pull request.

Before opening a pull request, download golangci-lint and run

golangci-lint run

If there aren't errors, go ahead :)

License 📝

This repository is under MIT License.
edoardottt.com to contact me.