Dreep SDKs for JavaScript and Go
Dreep has two official SDKs, the dreep package on npm and dreep-go for Go. Both have zero runtime dependencies, cover every endpoint and build transform and signed URLs locally. Any other language uses the same REST API.
How it works
The SDK runs on your server, next to your API key. Browsers never see the key and receive a single-use upload URL instead.
- 1
Your server
SDK + API key
- 2
Dreep API
upload, presign, confirm
- 3
Dreep storage
or your own bucket
- 4
Dreep CDN URL
width, format, quality
The same upload in each language
Upload a photo, convert it to WebP before storage, then build a thumbnail URL with no extra request.
import fs from "node:fs";
import { Dreep } from "dreep";
const dreep = new Dreep({ apiKey: process.env.DREEP_API_KEY });
const asset = await dreep.upload({
file: fs.createReadStream("hero.jpg"),
transform: { width: 1200, format: "webp" },
});
const thumb = dreep.url(asset, { width: 400 });client, err := dreep.New(os.Getenv("DREEP_API_KEY"))
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})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"Pick an SDK
Choose by the language of the server that holds your API key.
JavaScript and TypeScript
npm install dreep- Node.js 18 or later.
- ESM and CommonJS, with its own types.
Go
go get github.com/IndigoSoftwares21/dreep-go- Go 1.22 or later.
- Standard library only, with streaming uploads.
Frequently asked questions
Which languages have official Dreep SDKs?
JavaScript and TypeScript (the dreep package on npm) and Go (dreep-go). Every other language uses the REST API with a bearer API key.
Can I use the JavaScript SDK in the browser?
No. The SDK throws if it detects a browser. Your server presigns an upload and the browser PUTs the file to the single-use URL.
Do URL helpers make network calls?
No. url() and URL append transform parameters, and signedUrl() and SignedURL sign locally with your signing secret.
Are the SDKs open source?
Yes. Both are MIT licensed and developed on GitHub under IndigoSoftwares21.
Create a project and run your first upload
Create a free project, copy an API key and install the SDK for your language.