Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteObject(ctx context.Context, filePath string) error
- func Format(dataFile *models.DataFile)
- func GetObject(ctx context.Context, filePath string) (*models.DataFile, error)
- func ListObjects(ctx context.Context, path string, filter ...func(data *models.DataFile) bool) ([]*models.DataFile, error)
- func UnmarshalMetadata(metadata map[string]string, fileData *models.DataFile) error
- func UploadObject(ctx context.Context, filePath string, fileByte []byte, ...) error
- type FileHeader
Constants ¶
View Source
const ( HeaderAutoDeleteAt = "file-auto-delete-at" HeaderPrivateUrlExpires = "file-private-url-expires" HeaderIsPublic = "file-is-public" HeaderFileName = "file-name" DefaultTimeoutCtx = 25 * time.Second )
Since HTTP 1.1 is case insensitive, but we follow HTTP 2.0 standard which is lowercase
Variables ¶
View Source
var AcceptedContentType = []string{
fiber.MIMEApplicationJSONCharsetUTF8,
fiber.MIMEApplicationJSON,
fiber.MIMETextHTMLCharsetUTF8,
fiber.MIMETextHTML,
fiber.MIMETextPlainCharsetUTF8,
fiber.MIMETextPlain,
fiber.MIMETextJavaScriptCharsetUTF8,
fiber.MIMETextJavaScript,
fiber.MIMEApplicationXMLCharsetUTF8,
fiber.MIMEApplicationXML,
fiber.MIMETextXML,
fiber.MIMETextXMLCharsetUTF8,
"text/csv",
"text/css",
"video/mpeg",
"audio/mpeg",
"application/epub+zip",
"application/epub",
"image/gif",
"image/jpeg",
"application/pdf",
"audio/wav",
"audio/ogg",
"image/png",
"application/font-woff",
"font/woff",
"font/woff2",
"application/x-compressed",
"application/x-7z-compressed",
"application/vnd.ms-excel",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/msword",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"application/vnd.ms-powerpoint",
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
"application/x-sh",
"image/svg+xml",
"application/x-tar",
"application/x-gzip",
"application/gzip",
"image/webp",
"image/x-icon",
"image/vnd.microsoft.icon",
"image/avif",
"application/wasm",
"application/x-zip-compressed",
"application/zip",
}
Functions ¶
func GetObject ¶
GetObject return Name object will be in format `username/filename` as standard format in upload file
func ListObjects ¶
func UnmarshalMetadata ¶
should guarantee metadata use lowercase as file header follow HTTP 2.0 standard
Types ¶
type FileHeader ¶
func MapFileHeader ¶
func MapFileHeader(header map[string][]string) FileHeader
map http header to file header return new map and key is lowercase
Click to show internal directories.
Click to hide internal directories.