You can use this construct:
import "io" import "io/ioutil" io.CopyN(ioutil.Discard, yourReader, count)
It copies the requested number of bytes to io.Writer , which discards what it reads.
If your io.Reader is io.Seeker , you might want to search the stream to skip the number of bytes you want to skip:
import "io" import "io/ioutil" import "os" if s, ok = yourReader.(io.Seeker); ok { s.Seek(count, os.SEEK_CUR) // seek relative to current file pointer } else { io.CopyN(ioutil.Discard, yourReader, count) }
source share