viant / afs

Abstract File Storage
Apache License 2.0
297 stars 34 forks source link

Set content type as option #11

Closed fdelbos closed 2 years ago

fdelbos commented 2 years ago

Hi!

I want to set the content type of the file when i save it to cloud storage (ex: image/jpeg), but cant find the correct option for my call:

wc, err := afs.New().NewWriter(ctx, dest, 0644)

(by the way thanks for this package, its awesome!)

adranwit commented 2 years ago

You can use content.Meta option,

fs := New()
wc, err := fs.NewWriter(ctx, dest, 0644, content.NewMeta(content.Type, "image/jpeg"))
fdelbos commented 2 years ago

Awesome! Thanks for the quick answer.