ICBucket
ICBucketv1.0
Overview
  • Introduction
  • Quick Start
  • Installation
Guides
  • Configuration
  • Authentication
  • Basic Usage
  • Best Practices
API Reference
  • API Overview
  • API Endpoints
  • API Requests
  • API Responses
Errors
  • Error Codes
  • Error Handling
  • Troubleshooting
Deployment
  • Local Development
  • Production Deployment
Reference
  • Configuration Reference
  • Types Reference
  • Changelog
FAQ
  • Frequently Asked Questions
PricingGitLabNew bucket
  1. ICBucket
  2. Guides
  3. Basic Usage

Basic Usage

Perform essential storage operations: file upload, download, folder listing, file deletion, and metadata tagging.

Basic Usage

This guide covers the core operations supported by ICBucket: uploading files (small and large chunked files), downloading, folder navigation, tagging, and deletion.

Prerequisites#

  • An initialized ICBucket instance with write permissions.

Steps#

1. Uploading Files#

For files smaller than 2MB, single-call upload is instantaneous:

const result = await bucket.uploadFile("docs/spec.pdf", pdfBuffer, {
  contentType: "application/pdf",
  tags: ["documentation", "v1.2"],
  visibility: "public",
})

console.log("Edge URL:", result.publicUrl)

For large files (up to 50MB+), the SDK automatically chunks data into 2MB fragments:

const session = await bucket.uploadLargeFile("videos/demo.mp4", videoStream, {
  contentType: "video/mp4",
  onProgress: (percent) => console.log(`Upload: ${percent}%`),
})

2. Listing Files and Folders#

Navigate folders with built-in pagination (10 items per page):

const page = await bucket.listFiles({
  prefix: "images/",
  page: 1,
  pageSize: 10,
})

console.log("Total files:", page.total)
page.items.forEach((file) => console.log(file.name, file.sizeBytes))

3. Deleting Files#

Permanently purge an asset and free up allocated canister quota:

await bucket.deleteFile("temp/scratch.png")

Verification#

Confirm the file exists and is indexed:

const file = await bucket.getFileInfo("docs/spec.pdf")
console.log("File size:", file.sizeBytes, "Uploaded at:", file.createdAt)

Related Pages#

  • Best Practices
  • Endpoints Reference
  • Error Handling
PreviousAuthenticationNextBest Practices
Edit this page on GitLabUpdated recently

On this page

PrerequisitesSteps1. Uploading Files2. Listing Files and Folders3. Deleting FilesVerificationRelated Pages

Search documentation

Quickly find guides, APIs, and reference docs