Go SDK for image and video uploads
dreep-go is the official Go SDK for Dreep, for Go 1.22 or later. It uses only the standard library, streams uploads instead of buffering them, presigns browser uploads and builds transform and signed URLs locally.
How browser uploads work
Browsers never hold your API key. Your handler returns a single-use upload URL, valid for 10 minutes, and the browser PUTs the file there.
- 1
Browser asks
name, type and size
- 2
Handler presigns
PresignUpload
- 3
Browser PUTs
bytes to uploadUrl
- 4
Handler confirms
ConfirmUpload
- 5
Asset ready
CDN URL returned
Install and upload
Keep the API key in an environment variable on your server. The cURL tab shows the request Upload sends.
client, err := dreep.New(
os.Getenv("DREEP_API_KEY"),
dreep.WithSigningSecret(os.Getenv("DREEP_SIGNING_SECRET")),
)
f, err := os.Open("hero.jpg")
defer f.Close()
asset, err := client.Upload(ctx, dreep.UploadOptions{
File: f,
Filename: "hero.jpg",
Transform: &dreep.Transform{Width: 1200, Format: dreep.FormatWebP},
})
thumb := client.URL(asset.ID, &dreep.Transform{Width: 400}) // no network call
// Signed folders: pass nil as the transform
signed, err := client.SignedURL(asset.ID, 15*time.Minute, nil)curl -X POST https://api.dreep.cloud/api/v1/upload \
-H "Authorization: Bearer $DREEP_API_KEY" \
-F "file=@hero.jpg" \
-F "width=1200" \
-F "format=webp"Why use the package
Standard library only
Nothing is added to go.sum beyond the module itself.
Streaming uploads
Upload streams the multipart body, so a 400 MB video is never held in memory.
Retries that can't duplicate
Safe requests are retried on 429 and 5xx, and streaming uploads never are.
Frequently asked questions
How do I install the Dreep Go SDK?
Run go get github.com/IndigoSoftwares21/dreep-go. The package name is dreep and it needs Go 1.22 or later.
When should I use UploadPresigned instead of Upload?
Use UploadPresigned for large files or duplicate detection with ContentHash, since the bytes go straight to Dreep storage. Use Upload for a simple one-request upload.
Can I sign URLs without a network call?
Yes. Build the client with dreep.WithSigningSecret, then call client.SignedURL(assetID, ttl, nil). Pass nil as the transform, because the Go SDK signs only the asset ID and expiry.
Is dreep-go open source?
Yes. It is MIT licensed on GitHub at IndigoSoftwares21/dreep-go.
go get dreep-go and upload your first file
Create a free project, copy an API key and run the upload example.