A pure go implementation of epub file format.
import (
"bytes"
"fmt"
"io"
"github.com/n3integration/epub"
)
func main() {
+ // 1. Open the epub by passing its file path
f := "some.epub"
book, err := epub.Open(f)
defer book.Close()
+ // 2. Iterate over book sections
book.Each(func(title string, xhtml io.ReadCloser) {
+ // 3. Read and process section contents
buf := new(bytes.Buffer)
buf.ReadFrom(xhtml)
fmt.Println("==========================================================")
fmt.Println(title)
fmt.Println("==========================================================")
fmt.Println(buf.String())
})
}