Switch file to io stream in recognizer interface
This commit is contained in:
@@ -3,7 +3,7 @@ package yandex
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
@@ -65,14 +65,8 @@ func newYandexS3Service(cfg s3Config) (*yandexS3Service, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *yandexS3Service) uploadFile(filePath, fileName string) error {
|
||||
file, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open file %s: %w", filePath, err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
_, err = s.uploader.Upload(context.Background(), &s3.PutObjectInput{
|
||||
func (s *yandexS3Service) uploadFile(file io.Reader, fileName string) error {
|
||||
_, err := s.uploader.Upload(context.Background(), &s3.PutObjectInput{
|
||||
Bucket: aws.String(s.bucketName),
|
||||
Key: aws.String(fileName),
|
||||
Body: file,
|
||||
|
Reference in New Issue
Block a user