Epycbyte Blob Documentation
Use Cases
- Store and serve large files
- Organize files with folders and slashes
- Support range requests for partial downloads
- Track upload progress
- Abort ongoing operations
- Delete all blobs in a store
Getting Started
- Create an account on Epycbyte.
- Install the Epycbyte Blob SDK.
- Import the necessary modules.
Using Epycbyte Blob in Your Workflow
Server Upload Quickstart
Learn how to upload files to Epycbyte Blob using Server Actions or Route Handlers.
Client Upload Quickstart
Learn how to upload files to Epycbyte Blob using the Epycbyte Blob SDK.
Epycbyte Blob SDK
Learn how to use the Epycbyte Blob SDK.
Security
- Encryption is supported.
- Access control is available.
Viewing and Downloading Blobs
- Use the
getmethod to retrieve a blob. - Use the
listmethod to list all blobs in a store.
Caching
- Epycbyte Blob supports caching for frequently accessed files.
- Caching can be enabled or disabled using the
cacheparameter.
Folders and Slashes
- Epycbyte Blob supports folders and slashes in file paths.
- Folders are not actual directories, but rather a way to organize blobs.
Example: Creating a Folder
const blob = await put('folder/file.txt', 'Hello World!', { access: 'public' });
Range Requests
- Epycbyte Blob supports range requests for partial downloads.
- Range requests can be made using the
curlcommand or other tools.
Example: Downloading a File with Range Request
curl -r 0-4 https://1sxstfwepd7zn41q.public.blob.epycbyte-storage.com/range-requests.txt
Upload Progress
- Epycbyte Blob provides an
onUploadProgresscallback to track upload progress. - The callback is available on the
putanduploadmethods.
Example: Tracking Upload Progress
const blob = await upload('big-file.mp4', file, {
access: 'public',
handleUploadUrl: '/api/upload',
onUploadProgress: (progressEvent) => {
console.log(`Loaded ${progressEvent.loaded} bytes`);
console.log(`Total ${progressEvent.total} bytes`);
console.log(`Percentage ${progressEvent.percentage}%`);
},
});
Aborting Requests
- Epycbyte Blob operations can be canceled using the
AbortControllerAPI. - The
abortSignalparameter is available on theputanduploadmethods.
Example: Aborting a Request
const abortController = new AbortController();
try {
const blobPromise = epycbyteBlob.put('hello.txt', 'Hello World!', {
access: 'public',
abortSignal: abortController.signal,
});
// ...
} catch (error) {
if (error instanceof epycbyteBlob.BlobRequestAbortedError) {
console.info('canceled put request');
}
}
Deleting All Blobs
- Epycbyte Blob provides a method to delete all blobs in a store.
- The
delmethod is available on thelistresult.
Example: Deleting All Blobs
async function deleteAllBlobs() {
let cursor;
do {
const listResult = await list({ cursor, limit: 1000 });
if (listResult.blobs.length > 0) {
await del(listResult.blobs.map((blob) => blob.url));
}
cursor = listResult.cursor;
} while (cursor);
console.log('All blobs were deleted');
}
More Resources
- Server Upload Quickstart
- Client Upload Quickstart
- Epycbyte Blob SDK