I have a program that needs to work equally for a directory of files or for the 
contents of a zip file, so I'm using an fs.FS to abstract the two. 

Some of the files need to be provided to a PDF importer that accepts an 
io.ReadSeeker (#1).

Generally this is working fine except when trying to convert a zip file to an 
io.ReadSeeker. Concisely:

     1      package main
     2  
     3      import (
     4          "archive/zip"
     5          "fmt"
     6          "io"
     7      )
     8  
     9      func main() {
    10          z, _ := zip.OpenReader("a.zip")
    11          a, _ := z.Open("a") // a is a file in a.zip
    12          f, _ := a.Stat()
    13          fmt.Println(f.Name() == "a") // true
    14          fmt.Println(a.(io.ReadSeeker))
    15      }

Fails on line 14 with

interface conversion: *zip.checksumReader is not io.ReadSeeker: missing method 
Seek

Advice on how to rectify this would be gratefully received.

#1
https://github.com/phpdave11/gofpdf/blob/b09d9214a2296c8ea10312d9c5a520e27f2148c9/contrib/gofpdi/gofpdi.go#L52

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/YyulHNPauBLiO%2BWa%40campbell-lange.net.

Reply via email to