Whizan Cloud ServicesDocumentation Hub
Documentation/Storage & Persistence/Cloud Object Storage

Cloud Object Storage

Supported:@whizan/storage-jsWhizan CLI (whizan storage)@whizan/mcp-devops@aws-sdk/client-s3REST Presigned URLsCloudflare R2 Gateway

When to Use This Service

Ideal Use Cases
  • Media asset hosting: product images, banners, logos, audio tracks, and videos
  • User-generated content: avatars, profile pictures, identity verification documents, and attachments
  • Transactional documents: PDF invoices, payroll receipts, tax statements, and export reports
  • Public assets requiring ultra-low latency (<10ms) edge CDN caching with zero egress bandwidth charges
  • Private assets requiring time-limited signed URLs (e.g., 5-minute temporary download tokens)
  • Dynamic image optimization: resizing, WebP/AVIF format transcoding, quality adjustments, and cropping directly from URL parameters
  • Direct AWS S3 SDK, MinIO, or Cyberduck integrations via the built-in S3 Gateway protocol
When to Choose Another Workload
  • High-throughput in-memory caching or pub/sub message brokers (use Managed Redis instead)
  • Relational structured business tables with foreign keys and ACID transactions (use Managed PostgreSQL instead)
  • Temporary ephemeral build scratch files inside running backend containers (use local container disk)

How to Use & Deploy

Option 1Deploy via Web Console

  1. 1Open your Whizan Cloud Console and navigate to 'Cloud Storage' in the sidebar.
  2. 2Click '+ Create Bucket', enter a unique bucket name (e.g. 'user-assets'), and choose Public (direct CDN access) or Private (signed download links).
  3. 3Navigate to the 'Developer API' tab and click '+ Create Storage Key' to generate a dedicated scoped key (whz_stg_live_...).
  4. 4Pass hardware biometric verification (Touch ID / Face ID) or Email OTP to securely reveal and copy your key.
  5. 5Install @whizan/storage-js in your project and initialize the client to start uploading and downloading files.

Option 2Deploy via CLI & Terminal

Deploy instantly from your local workspace terminal using the global Whizan CLI:

$ whizan storage bucket create user-assets && whizan storage upload ./avatar.png user-assets/avatars/user-1.png
Or prompt your AI Coding Assistant (Cursor / Antigravity MCP):
“Check my Whizan storage quota, create a bucket named 'user-assets', and upload avatar.png”

Practical Project Example

whizan-storage-quickstart.ts
import { createClient } from "@whizan/storage-js";

// Initialize Whizan Storage Client
const storage = createClient(
  "https://api.whizan.cloud",
  process.env.WHIZAN_STORAGE_KEY! // whz_stg_live_...
);

// 1. Upload a file buffer or stream
const fileBuffer = Buffer.from("Hello Whizan Cloud Storage!");
const { data: uploadData, error: uploadErr } = await storage
  .from("user-assets")
  .upload("documents/welcome.txt", fileBuffer, {
    contentType: "text/plain",
    cacheControl: "public, max-age=86400, immutable",
    metadata: { author: "Whizan Dev", version: "1.0" },
  });

if (uploadErr) {
  console.error("Upload error:", uploadErr.message);
} else {
  console.log("Uploaded successfully:", uploadData.path, `(${uploadData.size} bytes)`);
}

// 2. Download a file as a Blob or Buffer
const { data: blob, error: dlErr } = await storage
  .from("user-assets")
  .download("documents/welcome.txt");

if (blob) {
  const content = await blob.text();
  console.log("File content:", content);
}

// 3. Generate a time-limited Presigned URL for private downloads
const { data: presign } = await storage
  .from("user-assets")
  .createSignedUrl("documents/welcome.txt", 3600); // 1 hour TTL

console.log("Signed Download URL:", presign?.signedUrl);

// 4. Generate optimized public CDN URL with edge image resizing
const { data: cdnUrl } = storage.from("public-media").getPublicUrl("banner.png", {
  width: 800,
  height: 600,
  format: "webp",
  quality: 85,
  resize: "cover",
});

console.log("Optimized WebP CDN URL:", cdnUrl.publicUrl);

// 5. Inspect quota allocation and committed usage
const { data: usage } = await storage.getUsage();
console.log(`Quota: ${usage.quota.usedMb} MB / ${usage.quota.allocatedMb} MB (${usage.quota.usagePercent}% used)`);

In-Depth Integration Guides & API Methods

The official zero-dependency client with Supabase API parity. Works seamlessly across Node.js, Next.js, Cloudflare Workers, Deno, Bun, and browser environments.

sdk-operations.ts
import { createClient } from "@whizan/storage-js";

const storage = createClient("https://api.whizan.cloud", process.env.WHIZAN_STORAGE_KEY!);

// ── File Operations ──
// Upload with upsert & metadata
await storage.from("invoices").upload("2026/january.pdf", pdfBuffer, {
  contentType: "application/pdf",
  cacheControl: "public, max-age=31536000, immutable",
  upsert: true,
  metadata: { invoiceId: "INV-2026-001", customerId: "cust_9812" }
});

// List files with pagination & sorting
const { data: files } = await storage.from("invoices").list("2026/", {
  limit: 20,
  sortBy: "createdAt",
  sortOrder: "desc"
});

// Atomic Move / Rename
await storage.from("invoices").move("2026/january.pdf", "archive/2026/january.pdf");

// Copy file
await storage.from("invoices").copy("archive/2026/january.pdf", "backup/january.pdf");

// Bulk Delete
await storage.from("invoices").remove(["backup/january.pdf", "temp/test.txt"]);

// Update metadata without re-uploading bytes
await storage.from("invoices").updateMetadata("archive/2026/january.pdf", {
  cacheControl: "public, max-age=31536000, immutable",
  metadata: { archivedAt: new Date().toISOString() }
});

// ── Bucket Operations ──
// List all buckets
const { data: buckets } = await storage.listBuckets();

// Create new bucket (Public or Private)
await storage.createBucket("avatars", {
  public: true,
  fileSizeLimit: 10 * 1024 * 1024, // 10 MB max
  allowedMimeTypes: ["image/png", "image/jpeg", "image/webp"]
});
MethodSignatureDescription
upload()upload(path, file, options?)Uploads Buffer/Blob/Stream with atomic quota reservation
download()download(path)Downloads file and returns a standard Web Blob
list()list(prefix?, options?)Lists and paginates objects with sorting by size, name, or date
move()move(fromPath, toPath, destBucket?)Atomically moves or renames an object
copy()copy(srcPath, destPath, destBucket?)Duplicates an object within or across buckets
remove()remove(paths[])Deletes one or multiple objects in a single batch call
getMetadata()getMetadata(path)Fetches object headers, MIME, and custom JSON metadata
updateMetadata()updateMetadata(path, meta)Updates Cache-Control and custom metadata in-place
createSignedUrl()createSignedUrl(path, ttl, opts?)Generates time-limited presigned URL for private downloads
getPublicUrl()getPublicUrl(path, transform?)Generates instant CDN URL with optional image resizing
Zero dependencies: Runs anywhere fetch and FormData are supported.
Atomic Quota Lock: Upload URLs reserve bytes for 15 minutes; if an upload fails or aborts, quota is automatically released.

Configuration Reference

Parameter / SettingDescriptionDefault / Recommended
Base Quota AllocationCommitted storage capacity allocated to account tier250 MB (Hobby Starter)
Max Single File SizeMaximum byte length allowed per single file upload50 MB
Bucket VisibilityPUBLIC (direct edge CDN URLs) or PRIVATE (signed download URLs required)PRIVATE (default)
Dynamic Image TransformsOn-the-fly edge Sharp image transcoding and resizingEnabled (Sub-10ms CDN cached)
Presigned URL TTLDefault and maximum expiration lifetime for signed download URLs3600s (configurable up to 86400s)
Soft-Delete Trash RetentionSoft-deleted objects remain recoverable before permanent purge30 Days
S3 API GatewayS3 protocol endpoint for AWS SDK, MinIO, and Cyberduckhttps://api.whizan.cloud/storage/v1/s3
Atomic Quota ReservationIn-flight byte reservation expiration window for unconfirmed uploads15 Minutes

Best Practices & Pro Tips

Tip 1Always use dedicated 'whz_stg_live_...' API keys for client and server storage integrations. They are scoped strictly to storage and protected by 2FA / Biometric review in the Console.
Tip 2For static media like banners and logos, always set 'Cache-Control: public, max-age=31536000, immutable' to enable 100% edge CDN cache hit ratios.
Tip 3Atomic Quota Lock: In-flight upload URLs reserve quota immediately. If a network drops or client disconnects, quota automatically unlocks after 15 minutes.
Tip 4Use 'storage.getS3Config()' to connect the official AWS S3 SDK (@aws-sdk/client-s3) with zero boilerplate.
Tip 5Leverage URL image optimization (?width=400&format=webp) to serve next-gen image formats automatically to mobile devices.