/volcano:volcano-storagefrom volcano
Use for file and object storage in Volcano apps, including uploads, downloads, photo galleries, file sharing, buckets, ownership-aware paths, public or private files, visibility, and resumable uploads.
Ships in volcano. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Implement secure storage flows with explicit bucket, path, and access-control intent. This skill is self-contained: bucket selection, every file operation, public/private semantics, resumable uploads, and error handling are embedded.
const avatars = volcano.storage.from('avatars');
const documents = volcano.storage.from('documents');
Create buckets with the CLI before referencing them — volcano storage bucket create <name> [--allowed-mime-type <type>] [--file-size-limit <bytes>] (local) / volcano cloud storage bucket create ... (cloud); volcano storage bucket list|get to check what already exists. volcano-config.yaml's buckets section (see volcano-platform) only manages policies on buckets that already exist — it never creates or deletes them.
A new bucket already has working owner-scoped RLS policies — do NOT hand-write them for the common case. bucket create installs defaults (default-auth-insert, default-auth-select-own, default-auth-update-own, default-auth-delete-own): any authenticated user can upload, and each user can read/update/delete only their own objects. So a private, per-user upload/list app needs zero policy setup — just create the bucket and upload under owner-scoped paths (below). Reach for volcano storage policy create only for non-default access (public read, cross-user sharing) — see "Custom policies". Creating owner-scoped policies by hand is the most common storage mistake: they already exist, and a wrong definition denies the very uploads it was meant to allow.
avatars/<userId>/profile.jpg
documents/<userId>/reports/<year>/<filename>.pdf
projects/<projectId>/assets/<assetType>/<filename>
Avoid: random/timestamp-only paths (file-${Date.now()}.pdf).
const fileInput = document.querySelector('input[type="file"]') as HTMLInputElement;
const file = fileInput.files![0];
const { data, error } = await volcano.storage
.from('avatars')
.upload(`${user.id}/profile.jpg`, file);
// data: { name, size, mime_type, ... }
await volcano.storage
.from('documents')
.upload('reports/annual-2024.pdf', file, { contentType: 'application/pdf' });
upload() accepts a File, Blob, or ArrayBuffer only. A Node Buffer
(or any Uint8Array) is rejected with Invalid file body type. Expected File, Blob, or ArrayBuffer — the common trap in server Functions, where an
image/PDF/QR generator hands you a Node Buffer. Wrap it in a Blob.
const blob = new Blob(['hello'], { type: 'text/plain' });
await volcano.storage.from('uploads').upload('notes/hello.txt', blob);
// In a Function: generators return a Node Buffer — wrap it, do NOT pass it directly.
// (QRCode here is the third-party `qrcode` npm package — add it to package.json so it bundles into the function.)
const png = await QRCode.toBuffer('https://example.com'); // Node Buffer
await volcano.storage.from('uploads').upload('codes/qr.png', new Blob([png]), {
contentType: 'image/png',
});
const { data: blob, error } = await volcano.storage
.from('documents')
.download('reports/annual-2024.pdf');
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'annual-2024.pdf';
a.click();
URL.revokeObjectURL(url);
const { data: blob } = await volcano.storage.from('avatars').download(`${userId}/profile.jpg`);
imgEl.src = URL.createObjectURL(blob);
const { data: blob } = await volcano.storage
.from('documents')
.download('large-file.zip', { range: 'bytes=0-1023' });
const { data: files, error } = await volcano.storage.from('uploads').list();
// file fields: name, size, mime_type, is_public, created_at, owner_id, public_url?
const { data: files } = await volcano.storage.from('uploads').list('images/');
const { data: mine } = await volcano.storage.from('documents').list(`${userId}/`);
const { data: files, nextCursor } = await volcano.storage
.from('uploads')
.list('', { limit: 100 });
if (nextCursor) {
const { data: more } = await volcano.storage
.from('uploads')
.list('', { limit: 100, cursor: nextCursor });
}
// Single
await volcano.storage.from('uploads').remove('old-file.txt');
// Multiple
const { data } = await volcano.storage.from('uploads').remove([
'temp/file1.txt',
'temp/file2.txt',
'temp/file3.txt',
]);
// data.deleted is the list of removed paths
await volcano.storage.from('documents').move('drafts/report.pdf', 'published/report.pdf');
await volcano.storage.from('documents').copy('templates/invoice.pdf', 'invoices/2024-001.pdf');
Files require an authenticated session to download.
const { data } = await volcano.storage
.from('avatars')
.updateVisibility(`${userId}/profile.jpg`, true);
// data.public_url present when true
await volcano.storage
.from('avatars')
.updateVisibility(`${userId}/profile.jpg`, false);
const { data } = volcano.storage.from('avatars').getPublicUrl(`${userId}/profile.jpg`);
// data.publicUrl: 'https://api.<project>.volcano.dev/public/<project-id>/avatars/<path>'
Public URLs require no auth, work in any browser, are CDN-friendly, and 403 if the file is later made private.
Use for files >100 MB or unreliable networks.
const { data, error } = await volcano.storage
.from('uploads')
.uploadResumable('large-video.mp4', file, {
onProgress: (uploaded, total) => {
const pct = Math.round((uploaded / total) * 100);
progressBar.value = pct;
},
});
// 1. Create session
const { data: session } = await volcano.storage
.from('uploads')
.createUploadSession('large-video.mp4', {
totalSize: file.size,
contentType: 'video/mp4',
partSize: 10 * 1024 * 1024, // 10 MB parts
});
// session: { session_id, total_parts, part_size }
// 2. Upload each part
for (let i = 1; i <= session.total_parts; i++) {
const start = (i - 1) * session.part_size;
const end = Math.min(start + session.part_size, file.size);
const partData = file.slice(start, end);
const { error } = await volcano.storage
.from('uploads')
.uploadPart('large-video.mp4', session.session_id, i, partData);
if (error) break; // can retry this part
}
// 3. Complete
await volcano.storage
.from('uploads')
.completeUploadSession('large-video.mp4', session.session_id);
const { data: status } = await volcano.storage
.from('uploads')
.getUploadSession('large-video.mp4', sessionId);
// status: { uploaded_parts, total_parts, uploaded_bytes, total_size, missing_parts, part_size }
for (const partNumber of status.missing_parts) {
const start = (partNumber - 1) * status.part_size;
const end = Math.min(start + status.part_size, file.size);
await volcano.storage
.from('uploads')
.uploadPart('large-video.mp4', sessionId, partNumber, file.slice(start, end));
}
await volcano.storage.from('uploads').completeUploadSession('large-video.mp4', sessionId);
await volcano.storage.from('uploads').abortUploadSession('large-video.mp4', sessionId);
Common error messages:
No active session — sign in first.File not found — wrong path or bucket.Permission denied — access policy violation.Bucket not found — invalid bucket name.File too large — exceeds size limit.const { data, error } = await volcano.storage.from('uploads').upload('file.txt', file);
if (error) {
console.error('Upload failed:', error.message);
}
// Allowed by typical "path starts with user's id" policy
await volcano.storage.from('uploads').upload(`${user.id}/avatar.jpg`, file);
// Denied
await volcano.storage.from('uploads').upload(`other-user-id/avatar.jpg`, file);
is_public).The auto-applied defaults already cover private per-user storage — don't recreate
them. For anything else, attach policies with the CLI (or volcano-config.yaml's
buckets.<name>.policies, which fully syncs declared policies). A --definition
is an RLS expression over the object row (columns include owner_id, name,
bucket_id, is_public):
volcano storage policy create avatars --operation SELECT --name public-read --definition "is_public = true"
volcano storage policy create avatars --operation INSERT --name authed-write --definition "auth.uid() IS NOT NULL"
volcano storage policy create docs --operation SELECT --name owner-read --definition "auth.uid() = owner_id"
volcano storage policy list|get|delete <bucket> to inspect/manage. --operation
is one of SELECT|INSERT|UPDATE|DELETE.
Policies inspect the user's role from the JWT (admin/user/etc.) — same client API, different rows visible.
const MAX = 10 * 1024 * 1024;
const ALLOWED = ['image/jpeg', 'image/png', 'image/gif'];
if (file.size > MAX) return showError('File too large');
if (!ALLOWED.includes(file.type)) return showError('Invalid file type');
const useResumable = file.size > 100 * 1024 * 1024;
const url = URL.createObjectURL(blob);
img.src = url;
// later:
URL.revokeObjectURL(url);
onProgress.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub kong/volcano-agentic-plugins --plugin volcano18 skills in this plugin
/install-volcanoInstall, upgrade, or set up the Volcano CLI. Use this whenever a task needs the volcano CLI and `which volcano` hasn't been confirmed yet, even if the user never says "install" (e.g. "build me a todo API using volcano")./volcano-authUse for Volcano authentication and identity work including user accounts, email or password sign-up and sign-in, OAuth, sessions, anonymous users, password recovery, and private or per-user data./volcano-databaseUse whenever a Volcano app stores or persists data, including CRUD, records, per-user data, migrations, RLS, todos, chat messages, polls, analytics, counters, click tracking, CMS content, feature flags, and leaderboards.Other plugins' skills for the same job