Skip to content

Instantly share code, notes, and snippets.

View jelgun's full-sized avatar

Elgun Jabrayilzade jelgun

View GitHub Profile
// ClamavReader is a custom reader used for clamavClient. The default reader used in the clamavClient does not read the last
// chunk of bytes when Read() returns EOF alongside read bytes, which is the case for reading responses from
// alicloud signed URLs. This custom reader makes sure that the EOF is returned only when no bytes were read.
type ClamavReader struct {
ReachedEOF bool
Reader io.Reader
}
func (c *ClamavReader) Read(p []byte) (int, error) {
if c.ReachedEOF {