edoardottt / go-readingtime

Estimate how long it takes to read a text

Home Page:https://edoardoottavianelli.it

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-readingtime

Estimate how long it takes to read a text

Coded with πŸ’™ by edoardottt

go action go report card

Install β€’ Usage β€’ Changelog β€’ Contributing β€’ License

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.
edoardoottavianelli.it to contact me.