pass reader around instead of []byte

This commit is contained in:
tsmethurst
2022-01-16 18:52:55 +01:00
parent 6f5ccf4355
commit 589bb9df02
14 changed files with 246 additions and 394 deletions

View File

@@ -20,6 +20,7 @@ package media
import (
"context"
"io"
"time"
)
@@ -28,7 +29,7 @@ import (
//
// See: https://en.wikipedia.org/wiki/File_format#File_header
// and https://github.com/h2non/filetype
const maxFileHeaderBytes = 262
const maxFileHeaderBytes = 261
// mime consts
const (
@@ -117,4 +118,4 @@ type AdditionalEmojiInfo struct {
}
// DataFunc represents a function used to retrieve the raw bytes of a piece of media.
type DataFunc func(ctx context.Context) ([]byte, error)
type DataFunc func(ctx context.Context) (io.Reader, error)