go.rice icon indicating copy to clipboard operation
go.rice copied to clipboard

Implement io.ReaderAt for File

Open microo8 opened this issue 6 years ago • 0 comments

If I add a zip file, and want to unzip it, the zip.NewReader takes a io.ReaderAt.

There is a workaround: I ask for the bytes of the file from rice and then create bytes.NewReader

fileBytes, err := box.Bytes("filename")
if err != nil {
  panic(err)
}
zr, err := zip.NewReader(bytes.NewReader(fileBytes), int64(len(fileBytes)))
...

But it would be great if I can use just rice.File for this.

microo8 avatar Jan 23 '19 08:01 microo8