Skip to content

cpyun/afero-minio

Repository files navigation

minio sdk for afero

Go Report Card GoDoc

About

It provides an afero filesystem implementation of a MinIO.

This was created to provide a backend to the MinIO server but can definitely be used in any other code.

I'm very opened to any improvement through issues or pull-request that might lead to a better implementation or even better testing.

Key points

  • Download & upload file streaming
  • Very carefully linted

Known limitations

  • File appending / seeking for write is not supported because MinIO doesn't support it, it could be simulated by rewriting entire files.
  • Chtimes is not supported because MinIO doesn't support it, it could be simulated through metadata.
  • Chmod support is very limited

How to use

import (
    "context"
    
    "github.com/minio/minio-go/v7"
	"github.com/cpyun/afero-minio"
)

func main() {
    minioClient := minio.New(endpoint, &opts)

	// Initialize the MinIOFS
    fs := miniofs.NewMinioFs(context.Background(), minioClient)
    
	// And use it
	file, _ := fs.Open("text.txt")
	defer file.Close()
	file.WriteString("Hello world.")
}

Thanks

License

Afero is released under the Apache 2.0 license. See LICENSE.txt

About

It provides an afero filesystem implementation of a MinIO.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages