Documentation ¶
Index ¶
- Constants
- Variables
- func DetectContentType(path string) (string, error)
- func IsNotFound(err error) bool
- type File
- type Manager
- func (m Manager) Delete(ctx context.Context, bucket, key string) error
- func (m Manager) DiscoverFiles(ctx context.Context, directoryPath string) (localFiles []string, err error)
- func (m Manager) GenerateETag(path string) (string, error)
- func (m Manager) Get(ctx context.Context, bucket, key string) (file File, contents io.ReadCloser, err error)
- func (m Manager) GetKey(rootPath, workingPath string) string
- func (m Manager) GetMeta(ctx context.Context, bucket, key string) (meta File, err error)
- func (m Manager) List(ctx context.Context, bucket string) ([]File, error)
- func (m Manager) ParallelismOrDefault() int
- func (m Manager) ProcessFiles(ctx context.Context, localFiles []string, directoryPath, bucket string) (invalidated []string, err error)
- func (m Manager) Put(ctx context.Context, fileInfo File) error
- func (m Manager) SyncDirectory(ctx context.Context, directoryPath, bucket string) (invalidations []string, err error)
- type Set
Constants ¶
View Source
const ( ACLPrivate = "private" ACLPublicRead = "public-read" )
ACLs
Variables ¶
View Source
var (
KnownExtensions = map[string]string{
".html": "text/html; charset=utf-8",
".xml": "text/xml; charset",
".json": "application/json; charset=utf-8",
".css": "text/css; charset=utf-8",
".js": "application/javascript",
".jpg": "image/jpeg",
".jpeg": "image/jpeg",
".png": "image/png",
}
)
KnownExtenions are known extenions mapped to their content types.
Functions ¶
func DetectContentType ¶
DetectContentType generates the content type of a given file by path.
func IsNotFound ¶
IsNotFound returns if an error is a not found error.
Types ¶
type File ¶
type File struct { ETag string Contents []byte ACL string FilePath string Bucket string Key string ContentType string ContentDisposition string ServerSideEncryption string }
File is info for a file upload.
func (File) ACLOrDefault ¶
ACLOrDefault returns the file ACL or a default.
type Manager ¶
type Manager struct { Log *log.Logger Ignores []string Config aws.Config Session *session.Session PutObjectDefaults File DryRun bool Parallelism int }
Manager is a helper for uploading files to s3.
func (Manager) DiscoverFiles ¶
func (m Manager) DiscoverFiles(ctx context.Context, directoryPath string) (localFiles []string, err error)
DiscoverFiles discovers local files.
func (Manager) GenerateETag ¶
GenerateETag generate an etag for a give file by path.
func (Manager) Get ¶
func (m Manager) Get(ctx context.Context, bucket, key string) (file File, contents io.ReadCloser, err error)
Get fetches a file at a given key
func (Manager) ParallelismOrDefault ¶
ParallelismOrDefault returns the parallelism or a default.
func (Manager) ProcessFiles ¶
func (m Manager) ProcessFiles(ctx context.Context, localFiles []string, directoryPath, bucket string) (invalidated []string, err error)
ProcessFiles processes the files list.
Click to show internal directories.
Click to hide internal directories.