jamesfcarter / s3httpfilesystem

An implementation of http.FileSystem for S3 buckets.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go Report Card Documentation

s3httpfilesystem implements the http.FileSystem interface allowing an S3 bucket to be easily served over http.

Example:

package main

import (
	"net/http"

	s3 "github.com/jamesfcarter/s3httpfilesystem"
)

func main() {
	endpoint := "s3-us-west-2.amazonaws.com"
	bucket := "example"
	region := "us-west-2"
	// Credentials come from the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
	// environment variables.
	s3FileSystem := s3.New(endpoint, region, bucket)
	http.ListenAndServe(":80", http.FileServer(s3FileSystem))
}

About

An implementation of http.FileSystem for S3 buckets.

License:GNU General Public License v3.0


Languages

Language:Go 100.0%