cloud-storage-web_skill

This skill helps you manage CloudBase cloud storage in web apps by uploading, generating temporary URLs, downloading, and deleting files with the Web SDK.
  • TypeScript

975

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill tencentcloudbase/cloudbase-mcp --skill cloud-storage-web

  • SKILL.md9.0 KB

Overview

This skill is a complete guide for using CloudBase cloud storage from web applications with the @cloudbase/js-sdk. It covers initialization, upload/download flows, temporary URLs, deletion, CORS setup, and practical best practices for production. Use it to implement reliable browser-based file storage and retrieval workflows.

How this skill works

The skill explains how to initialize the CloudBase Web SDK with a single shared app instance and then call storage APIs: uploadFile for browser uploads, getTempFileURL for expiring download links, deleteFile for removals, and downloadFile for direct browser downloads. It also covers progress callbacks, batch operations, response handling, and required CORS/security domain configuration.

When to use it

  • Implementing browser uploads and showing upload progress to users
  • Generating temporary, time-limited download URLs for private files
  • Cleaning up or batch-deleting unused files from cloud storage
  • Providing user-triggered downloads from the browser
  • Integrating file storage into a serverless web app without Node SDKs

Best practices

  • Initialize the SDK synchronously and reuse a single app instance across the app
  • Add your frontend domain to CloudBase security domains to avoid CORS errors
  • Validate file type and size client-side and show upload progress for large files
  • Organize files with consistent folder structures and descriptive filenames (include timestamps when useful)
  • Use getTempFileURL for programmatic access and set appropriate maxAge; respect expiration when caching
  • Batch operations (fileList arrays) to improve efficiency and check each result code

Example use cases

  • A profile avatar uploader that uploads files, shows progress, and deletes old avatars
  • Generating one-hour download links for private reports to embed in emails
  • Cleaning temporary uploads after a workflow completes to save storage costs
  • Downloading user-exported documents directly from the browser with downloadFile
  • Handling multiple image uploads for a gallery with concurrent upload limits and progress UI

FAQ

Add your frontend domain (e.g., https://your-app.com or http://localhost:3000) to CloudBase Console → Environment → Security Sources → Security Domains. If issues persist, remove and re-add the domain.

When should I use getTempFileURL vs downloadFile?

Use getTempFileURL to fetch expiring public links for programmatic access or previews. Use downloadFile for immediate, user-initiated browser downloads (save dialog).

How do I handle upload progress?

Pass an onUploadProgress callback to uploadFile to compute percent = loaded/total and update a UI progress bar.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational