Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jszwec/s3fs
S3 FileSystem (fs.FS) implementation
https://github.com/jszwec/s3fs
filesystems fs go golang s3 s3-bucket
Last synced: 3 months ago
JSON representation
S3 FileSystem (fs.FS) implementation
- Host: GitHub
- URL: https://github.com/jszwec/s3fs
- Owner: jszwec
- License: mit
- Created: 2021-01-12T03:52:54.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-11T00:38:40.000Z (11 months ago)
- Last Synced: 2024-06-19T15:51:46.004Z (5 months ago)
- Topics: filesystems, fs, go, golang, s3, s3-bucket
- Language: Go
- Homepage:
- Size: 66.4 KB
- Stars: 172
- Watchers: 2
- Forks: 19
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# s3fs [![Go Reference](https://pkg.go.dev/badge/github.com/jszwec/s3fs.svg)](https://pkg.go.dev/github.com/jszwec/s3fs) ![Go](https://github.com/jszwec/s3fs/workflows/Go/badge.svg?branch=main)
Package s3fs provides a S3 implementation for Go1.16 [filesystem](https://tip.golang.org/pkg/io/fs/#FS) interface.
Since S3 is a flat structure, s3fs simulates directories by using
prefixes and "/" delim. ModTime on directories is always zero value.# SDK Versions
```github.com/jszwec/s3fs``` uses aws sdk v1```github.com/jszwec/s3fs/v2``` uses aws sdk v2
# Example (SDK v1)
```go
const bucket = "my-bucket"s, err := session.NewSession()
if err != nil {
log.Fatal(err)
}s3fs := s3fs.New(s3.New(s), bucket)
// print out all files in s3 bucket.
_ = fs.WalkDir(s3fs, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}if d.IsDir() {
fmt.Println("dir:", path)
return nil
}
fmt.Println("file:", path)
return nil
})
```# Installation
```
go get github.com/jszwec/s3fs
```# Requirements
* Go1.16+