all repos — navani @ 2928def670071abf79a9dd21ecbaa532149405f4

forlater's primary mail processing service

reader/plain.go (view raw)

 1package reader
 2
 3import (
 4	"os/exec"
 5	"strings"
 6)
 7
 8func MakePlaintext(html []byte) ([]byte, error) {
 9	args := []string{
10		"-dont_wrap_pre",
11		"-display_charset=UTF-8",
12		"-image_links",
13		"-dump",
14		"-stdin",
15	}
16	cmd := exec.Command("lynx", args...)
17	cmd.Stdin = strings.NewReader(string(html))
18	out, err := cmd.Output()
19	if err != nil {
20		return nil, err
21	}
22	return out, nil
23}