Dreep SDKs for JavaScript and Go
Dreep has two official SDKs: the dreep package on npm for Node.js and TypeScript, and dreep-go for Go 1.22 or later. Both have zero runtime dependencies, cover every endpoint from uploads to OCR, and build transform and signed URLs locally without a network call. Any other language talks to the same REST API with a bearer API key.
Pick an SDK
Both SDKs wrap the same REST API and return the same assets, so a team can run a Node.js web app and a Go worker against one project without translating anything. Choose by the language of the server that holds your API key.
JavaScript and TypeScript
npm install dreep- Node.js 18 or later.
- No runtime dependencies: built on native fetch and node:crypto.
- ESM and CommonJS, with its own .d.ts types.
- Typed transform parameters: an invalid fit or rotate value fails at compile time.
Go
go get github.com/IndigoSoftwares21/dreep-go- Go 1.22 or later.
- No dependencies: net/http, mime/multipart and crypto/hmac from the standard library.
- Every request method takes a context.Context first.
- Streams multipart uploads instead of buffering the file in memory.
The same upload in each language
Upload a photo into a folder, resize and convert it to WebP before storage, then build a square thumbnail URL from the stored asset. The URL step is string work in both SDKs, so it costs no request and no API call.
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"),
folder: "marketing/2026",
transform: { width: 1200, format: "webp" },
});
const thumb = dreep.url(asset, { width: 400, height: 400, fit: "cover" });client, err := dreep.New(os.Getenv("DREEP_API_KEY"))
if err != nil {
log.Fatal(err)
}
f, err := os.Open("hero.jpg")
if err != nil {
log.Fatal(err)
}
defer f.Close()
asset, err := client.Upload(ctx, dreep.UploadOptions{
File: f,
Filename: "hero.jpg",
Destination: dreep.Destination{Folder: "marketing/2026"},
Transform: &dreep.Transform{Width: 1200, Format: dreep.FormatWebP},
})
if err != nil {
log.Fatal(err)
}
thumb := client.URL(asset.ID, &dreep.Transform{Width: 400, Height: 400, Fit: dreep.FitCover})curl -X POST https://api.dreep.cloud/api/v1/upload \
-H "Authorization: Bearer $DREEP_API_KEY" \
-F "file=@hero.jpg" \
-F "folder=marketing/2026" \
-F "width=1200" \
-F "format=webp"
# Any size from the returned asset id, generated on first request
curl -o thumb.webp \
"https://cdn.dreep.cloud/api/v1/fetch/<assetId>?width=400&height=400&fit=cover"Where the SDK sits
The SDK runs on your server, next to your API key. It talks to the Dreep API for writes and reads, and hands you CDN URLs that your pages and apps load directly. Browsers never see the key: they receive a single-use upload URL from your backend instead.
Your server
SDK + API key
Dreep API
upload, presign, confirm, list
Dreep storage
or your own bucket on paid plans
Dreep CDN URL
width, format, quality as params
What both SDKs handle for you
Calling the REST API directly is fine. The SDKs exist to remove the parts that are easy to get subtly wrong.
Signed URLs without hand-rolled HMAC
signedUrl() and SignedURL compute the HMAC-SHA256 signature and expiry locally with your project's signing secret. Links for signed folders cost no API request and work until the expiry you set.
The presigned upload flow
Presign, PUT and confirm, including the contentHash shortcut that skips the PUT when Dreep already stores identical bytes. The Go SDK also wraps all three steps in one UploadPresigned call.
Errors you can branch on
JavaScript throws DreepError subclasses such as DreepLimitError and DreepNotFoundError. Go returns *dreep.Error with IsNotFound, IsConflict and IsPaymentRequired helpers. Plan-limit errors carry the feature, usage and cap.
Retries that never duplicate an upload
Safe requests are retried with exponential backoff. Uploads are never retried automatically, so a timeout can't store the same file twice or bill a second transformation.
BIGINT fields as numbers
The API serialises sizeBytes and storageBytes as strings to stay safe for large values. The JavaScript SDK converts them to numbers, and the Go SDK decodes either form behind .Int64().
Server-only by design
Your API key can read, upload and delete everything in a project. The JavaScript SDK throws if it detects a browser at construction, and both SDKs document the presigned route for client uploads.
Method coverage
Both SDKs cover the full public API. Names follow each language's conventions: camelCase methods taking one options object in JavaScript, exported methods with a context and typed option structs in Go.
| Capability | JavaScript | Go | REST |
|---|---|---|---|
| Upload a file | upload() | Upload | POST /upload |
| Start a presigned upload | presignUpload() | PresignUpload | POST /upload/presign |
| Confirm a presigned upload | confirmUpload() | ConfirmUpload | POST /upload/{id}/confirm |
| Presign, PUT and confirm in one call | Three calls | UploadPresigned | Three requests |
| Transform URL | url() | URL | Query params on the CDN URL |
| Signed URL | signedUrl() | SignedURL | exp and sig params, HMAC-SHA256 |
| List media | listMedia(), listAllMedia() | ListMedia, ListAllMedia | GET /media |
| Delete media | deleteMedia() | DeleteMedia | DELETE /media/{id} |
| Folders | createFolder(), listFolders() | CreateFolder, ListFolders | POST and GET /folders |
| Presets | createPreset(), listPresets(), deletePreset() | CreatePreset, ListPresets, DeletePreset | /presets |
| OCR on upload | extractText() | UploadAndExtractText | POST /ocr |
| OCR on a stored asset | url(asset, { format: "txt" }) | ExtractText | format=txt on the CDN URL |
| Background removal | removeBackground() | RemoveBackground | POST /bg-remove |
| Usage | getUsage() | GetUsage | GET /usage |
Where the two SDKs differ
The feature set is the same. Runtime behaviour follows what is idiomatic in each language, which matters most for large files and for timeouts.
| Behaviour | JavaScript | Go |
|---|---|---|
| Large files through upload() | A Node Readable is read into memory before sending, so use the presigned flow for big files. | Upload streams the multipart body through an io.Pipe. Pass KnownSize for an exact Content-Length. |
| Timeouts | 30 seconds per request by default. Uploads have none; bound them with an AbortSignal. | No global timeout. Bound each call with a context deadline. |
| Retries | Safe, idempotent reads are retried twice with exponential backoff. | Replayable requests are retried on 429 and 5xx: two retries, 500ms doubling, Retry-After honoured. Configurable with WithMaxRetries. |
| Errors | Classes: DreepAuthError, DreepValidationError, DreepNotFoundError, DreepConflictError, DreepLimitError, DreepConnectionError. | One *dreep.Error type plus IsUnauthorized, IsNotFound, IsConflict, IsPaymentRequired, IsInvalidRequest and FeatureLimit. |
Any other language, via REST
There are no official SDKs beyond JavaScript and Go. Python, Ruby, PHP, Rust, Java or anything else with an HTTP client uses the REST API directly: send Authorization: Bearer with your API key, multipart for simple uploads, and JSON for everything else. This is the presigned flow for a large file.
# 1. Presign on your server, with your API key
curl -X POST https://api.dreep.cloud/api/v1/upload/presign \
-H "Authorization: Bearer $DREEP_API_KEY" \
-H "Content-Type: application/json" \
-d '{"filename":"clip.mp4","contentType":"video/mp4","sizeBytes":52428800,"folder":"uploads"}'
# => { "id": "...", "uploadUrl": "https://cdn.dreep.cloud/..." }
# 2. PUT the raw bytes from anywhere, no API key needed
curl -X PUT "$UPLOAD_URL" \
-H "Content-Type: video/mp4" \
--data-binary @clip.mp4
# 3. Confirm on your server; the asset becomes ready
curl -X POST "https://api.dreep.cloud/api/v1/upload/$UPLOAD_ID/confirm" \
-H "Authorization: Bearer $DREEP_API_KEY"The upload URL is single-use and valid for 10 minutes, and the Content-Type and Content-Length of the PUT must match what you presigned. To sign a URL for a signed folder yourself, compute an HMAC-SHA256 hex digest of assetId:expires with your project's URL signing secret and append exp and sig as query parameters.
Who this is for
- Backends written in Node.js, TypeScript or Go that upload, list or delete media.
- Teams that want a client with no third-party packages in their dependency tree.
- Apps where browsers or mobile clients upload directly with a presigned URL your server issues.
- Projects mixing languages, such as a Next.js front end and a Go worker on one Dreep project.
When Dreep is not the right fit
- You need an official Python, Ruby or PHP SDK. Those don't exist; use the REST API.
- You want to call Dreep from browser or mobile code with your API key. That is not supported by design.
- You are looking for drop-in upload widgets or UI components. The SDKs are server-side API clients.
Frequently asked questions
Which languages have official Dreep SDKs?
JavaScript and TypeScript (the dreep package on npm, Node.js 18 or later) and Go (github.com/IndigoSoftwares21/dreep-go, Go 1.22 or later). Every other language uses the REST API at api.dreep.cloud/api/v1 with a bearer API key.
Can I use the JavaScript SDK in the browser?
No. The API key is a full-project credential, so the SDK throws on construction if it detects a browser. Your server calls presignUpload() and passes the single-use upload URL to the browser, which PUTs the file there. Your server then calls confirmUpload().
Do the SDKs add dependencies to my project?
No. The JavaScript SDK is built on native fetch and node:crypto, and the Go SDK uses only the standard library. Neither pulls in a third-party package at runtime.
Do the JavaScript and Go SDKs support the same features?
Yes: uploads, presigned uploads, media listing and deletion, folders, presets, OCR, background removal, usage, transform URLs and signed URLs. Go adds UploadPresigned, which runs presign, PUT and confirm in one call, and ExtractText for OCR on an asset that is already stored.
Do URL helpers make network calls?
No. url() and URL append transform parameters to the asset's CDN URL, and signedUrl() and SignedURL compute the signature locally with your signing secret. They are safe to call in a render path or a tight loop.
Are the SDKs open source?
Yes. Both are MIT licensed and developed on GitHub under IndigoSoftwares21, where you can read the source, open issues and send pull requests.
Related
JavaScript and TypeScript SDK
Server uploads, browser presigned uploads, url(), signedUrl(), errors and cancellation.
Go SDK
Streaming uploads, UploadPresigned, an http.Handler for browser uploads, retries.
Next.js integration
Route handlers that presign uploads and serve transformed images.
Secure file uploads
What Dreep validates on upload and what your backend still owns.
Documentation
API reference, guides and the full method reference for both SDKs.
Pricing
Free, Starter and Pro plans, storage and transformation limits, add-ons.
Create a project and run your first upload
The free plan includes 1 GB of storage and 100 image transformations a month. Create a project, copy an API key, and install the SDK for your language.