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. 1

    Your server

    SDK + API key

  2. 2

    Dreep API

    upload, presign, confirm

  3. 3

    Dreep storage

    or your own bucket

  4. 4

    Dreep CDN URL

    width, format, quality

Transforms run when a URL is first requested, then are served from cache.

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 });

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.

Related

Create a project and run your first upload

Create a free project, copy an API key and install the SDK for your language.