NewS3Store (storage/s3.go)

LocalAI · core/services/storage/s3.go · go · MIT
integration

S3-backed object store with CRUD and listing operations.

// Source: https://github.com/mudler/LocalAI | License: MIT | Copyright 2023-2025 Ettore Di Giacinto (mudler@localai.io)
// Provided via justclaw.it.com; keep this notice with the code.
package storage

import (
	"context"
	"errors"
	"fmt"
	"io"
	"time"

	"github.com/aws/aws-sdk-go-v2/aws"
	awsconfig "github.com/aws/aws-sdk-go-v2/config"
	"github.com/aws/aws-sdk-go-v2/credentials"
	"github.com/aws/aws-sdk-go-v2/service/s3"
	"github.com/aws/aws-sdk-go-v2/service/s3/types"
)

// S3Store implements ObjectStore backed by an S3-compatible service (AWS S3 or MinIO).
type S3Store struct {
	client *s3.Client
	bucket string
}

// S3Config holds S3 connection parameters.
type S3Config struct {
	Endpoint        string // e.g. "http://minio:9000" (empty for AWS S3)
	Region          string // e.g. "us-

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key