Storage

SDK

Cludz Storage SDK

The Cludz SDK provides a simple and efficient way to interact with Cludz Storage. It supports multiple environments including Node.js and Bun.

Installation

bunx jsr add @cludz/sdk

Initialization

To use the Storage features, you can instantiate the standalone Storage class.

import { Storage } from "@cludz/sdk";

const storage = new Storage({
  api: "https://storage.cludz.net",
  id: "YOUR_STORAGE_ID",
  token: "YOUR_API_TOKEN"
});

Methods

upload

Upload a file to a specific directory.

// Upload using local path
await storage.upload("/", "./local-file.png");

// Upload using Blob/File
const blob = new Blob(["hello world"], { type: "text/plain" });
await storage.upload("/texts", blob, "hello.txt");

list

List contents of a directory.

const files = await storage.list("/");

files.forEach(file => {
  console.log(`${file.isDirectory ? '[DIR]' : '[FILE]'} ${file.name} - ${file.size} bytes`);
});

createFolder

Create a new directory.

await storage.createFolder("/", "my-new-folder");

createFile

Create an empty file.

await storage.createFile("/", "empty.txt");

rename

Rename a file or folder.

await storage.rename("/old-name.txt", "new-name.txt");

delete

Delete a file or folder.

await storage.delete("/unwanted-file.txt");

download

Download a file as a Blob.

const blob = await storage.download("/image.png");
// You can then use the blob (e.g., save to disk or display in browser)

Types

The SDK provides TypeScript definitions for all responses.

import type { FileInfo } from "@cludz/sdk";

const files: FileInfo[] = await storage.list("/");
Built with 💖 by Miza • © 2026 - Powered by Nuxt