Index of every page on this site: llms.txt
All skills
encoredev avatar

/bucket

@e86a3ab official
by Encoreencoredev/skills30 stars
6
Run it yourself

Store unstructured files in Encore.ts using `Bucket` from `encore.dev/storage/objects` — uploads, images, documents, blobs.

  • 1 file
  • 3.1 KB
  • Updated 6 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/encoredev/skills/bucket

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈33 tokens for metadata: the name and description. ≈612 when used: this file.

Description uses 8.5% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈678 characters, or 8.5%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Encore Object Storage

Instructions

A Bucket is a logical store for files. Encore provisions the underlying object storage (S3 on AWS, GCS on GCP, in-memory locally). Declare buckets at package level.

import { Bucket } from "encore.dev/storage/objects";

// Private bucket (default)
export const uploads = new Bucket("user-uploads", {
  versioned: false,  // Set to true to keep multiple versions
});

// Public bucket — files accessible via public URL
export const publicAssets = new Bucket("public-assets", {
  public: true,
  versioned: false,
});

Operations

// Upload
const attrs = await uploads.upload("path/to/file.jpg", buffer, {
  contentType: "image/jpeg",
});

// Download
const data = await uploads.download("path/to/file.jpg");

// Existence check
const exists = await uploads.exists("path/to/file.jpg");

// Attributes (size, content type, ETag)
const meta = await uploads.attrs("path/to/file.jpg");

// Delete
await uploads.remove("path/to/file.jpg");

// List
for await (const entry of uploads.list({})) {
  console.log(entry.key, entry.size);
}

// Public URL (only for public buckets)
const url = publicAssets.publicUrl("image.jpg");

Signed URLs

Generate temporary URLs so clients can upload/download directly without going through your service:

const uploadUrl = await uploads.signedUploadUrl("user-uploads/avatar.jpg", { ttl: 7200 });
const downloadUrl = await uploads.signedDownloadUrl("documents/report.pdf", { ttl: 7200 });

Bucket References

Pass bucket access to other code with a specific permission set:

import { Uploader, Downloader } from "encore.dev/storage/objects";

const uploaderRef = uploads.ref<Uploader>();
const downloaderRef = uploads.ref<Downloader>();

// Permission types: Downloader, Uploader, Lister, Attrser, Remover,
// SignedDownloader, SignedUploader, ReadWriter

Errors

  • ObjectNotFound — object doesn't exist
  • PreconditionFailed — upload preconditions not met (e.g. setIfNotExists)
  • ObjectsError — base error type

Guidelines

  • Declare buckets at package level.
  • Default to private buckets; opt into public: true only for assets meant for unauthenticated download.
  • Use signed URLs for browser uploads/downloads instead of streaming through your service.
  • Use bucket references when passing access to helpers — they encode the permission contract in the type system.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at e86a3ab. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 weeks ago.

Activeupdated 6 months ago
Other metadata
when_to_use
User wants to upload, download, list, or delete files — profile pictures, avatars, document uploads, image storage, media assets, generated reports, blob data. Covers public vs private buckets, signed upload/download URLs, bucket references with permission types (Uploader, Downloader, Lister, Attrser, Remover), and operations like `upload()`, `download()`, `list()`, `signedUploadUrl()`. Trigger phrases: "object storage", "bucket", "S3", "GCS", "blob", "user uploads", "profile picture", "image upload", "store a file", "file storage".
  • TypeScript
  • encore
  • object-storage
  • s3
  • gcs
  • file-upload
  • bucket
  • signed-urls

README badge

README badge for encoredev/skills/bucket

Store unstructured files with Encore's Bucket API — upload, download, list, delete, and generate signed URLs for direct client access. Covers private and public buckets, permission-scoped references, and works with S3 on AWS or GCS on GCP.

Generated from the current SKILL.md.

Does Encore handle the underlying object storage infrastructure?
Yes. Encore provisions S3 on AWS, GCS on GCP, and in-memory storage locally — you declare buckets in code and Encore manages the backend.
Can I generate temporary upload or download URLs for clients?
Yes. Use `signedUploadUrl()` and `signedDownloadUrl()` with a TTL to let clients upload or download directly without routing through your service.
How do I control who can access a bucket?
Declare buckets as private (default) or public. For fine-grained control, use bucket references with permission types like `Uploader`, `Downloader`, `Lister`, and `Remover` to pass scoped access to other code.
What operations are supported on buckets?
Upload, download, list, delete, check existence, fetch metadata (size, content type), generate public URLs (for public buckets), and generate signed URLs for temporary access.
Can I version files in a bucket?
Yes. Set `versioned: true` when declaring a bucket to keep multiple versions of each file.

Generated from the current SKILL.md. These answers refresh after source changes.