Buckets
ICBucket
ICPay Cloud guide
On-chain encrypted file storage
ICBucket
On-chain encrypted file storage
ICBucket
On-chain encrypted file storage
Guides
Perform essential storage operations: file upload, download, folder listing, file deletion, and metadata tagging.
This guide covers the core operations supported by ICBucket: uploading files (small and large chunked files), downloading, folder navigation, tagging, and deletion.
ICBucket instance with write permissions.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}%`),
})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))Permanently purge an asset and free up allocated canister quota:
await bucket.deleteFile("temp/scratch.png")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)