Preview. None of these libraries is published yet, and the examples show their planned interface. Until they ship, call the HTTP API directly: it is plain JSON over HTTPS, and works from any language.
Every SDK reads the key from UPLOADX_API_KEY, checks it with GET /v1/me on startup, and runs only on servers: none of them will run in a browser, where it would expose your key.
TypeScript
npm install @uploadx/sdkpnpm add @uploadx/sdkbun add @uploadx/sdkyarn add @uploadx/sdkimport { Uploadx } from "@uploadx/sdk";
const uploadx = new Uploadx({ apiKey: process.env.UPLOADX_API_KEY });
const file = await uploadx.files.upload({
file: await readFile("./onboarding.mp4"),
name: "onboarding.mp4",
});
const { url } = await uploadx.files.url(file.id);Go
go get github.com/uploadx/uploadx-goclient := uploadx.New(os.Getenv("UPLOADX_API_KEY"))
f, _ := os.Open("onboarding.mp4")
file, err := client.Files.Upload(ctx, f, "onboarding.mp4")
if err != nil {
log.Fatal(err)
}
fmt.Println(file.URL)Rust
cargo add uploadxuse std::{env, fs};
use uploadx::Uploadx;
let uploadx = Uploadx::new(env::var("UPLOADX_API_KEY")?);
let file = uploadx
.files()
.upload("onboarding.mp4", fs::read("onboarding.mp4")?)
.await?;
println!("{}", file.url);Python
pip install uploadximport os
from uploadx import Uploadx
uploadx = Uploadx(api_key=os.environ["UPLOADX_API_KEY"])
with open("onboarding.mp4", "rb") as f:
file = uploadx.files.upload(f, name="onboarding.mp4")
print(file.url)Any other language
Create the record with your key, then PUT the bytes to the uploadUrl it returns. See Upload a file for both requests.