ObitoX Docs
Providers
Storage ProviderINTELLIGENT CDN

Uploadcare

Automated image optimization & virus scanning

Intelligent file CDN with smart image optimization and automatic virus scanning. Transform images on-the-fly without extra infrastructure.

How it works

Files are uploaded to Uploadcare's intelligent CDN, automatically optimized, and scanned for threats before delivery.

Your App
myapp.com
Uploads file
Process
ObitoX
Intelligence
Optimizes & Scans
Deliver
CDN
Global Edge
Served globally
Auto WebP/AVIF
Virus Scanning
On-fly Resize

⚙️Setup

Initialize the ObitoX client with your Uploadcare credentials

typescript
1import ObitoX from '@obitox/upload';
2
3const client = new ObitoX({
4 apiKey: process.env.OBITOX_API_KEY,
5 apiSecret: process.env.OBITOX_API_SECRET
6});
7
8const uploadcare = client.uploadcare({
9 publicKey: process.env.UPLOADCARE_PUBLIC_KEY,
10 secretKey: process.env.UPLOADCARE_SECRET_KEY
11});

Upload Features

📤Basic Upload

typescript
1const fileUrl = await uploadcare.upload(file, {
2 filename: 'photo.jpg'
3});
4
5console.log(fileUrl); // https://ucarecdn.com/uuid/photo.jpg

Auto Image Optimization

Automatically convert to WebP/AVIF and optimize quality

typescript
1const fileUrl = await uploadcare.upload(file, {
2 filename: 'photo.jpg',
3 imageOptimization: { auto: true }
4});

🛠️Manual Optimization

Fine-tune compression and format settings

typescript
1const fileUrl = await uploadcare.upload(file, {
2 filename: 'photo.jpg',
3 imageOptimization: {
4 format: 'webp',
5 quality: 'best',
6 progressive: true,
7 stripMeta: 'all',
8 adaptiveQuality: true
9 }
10});
OptionValuesDescription
formatauto, webp, jpeg, pngOutput image format
qualitylightest to bestCompression level
adaptiveQualitytrue/falseAI quality optimization

📊Progress Tracking

Monitor upload progress in real-time

typescript
1const fileUrl = await uploadcare.upload(file, {
2 filename: 'photo.jpg',
3 onProgress: (percent, uploaded, total) => {
4 console.log(`${percent}% — ${uploaded}/${total} bytes`);
5 }
6});

🕵️Magic Bytes Validation

Validate file content matches extension

Client-Side Feature: This is an ObitoX SDK feature that runs in the browser/client to validate files before upload.
typescript
1const url = await uploadcare.upload(file, {
2 filename: 'photo.jpg',
3 validation: 'images'
4});

Validation presets: 'images' | 'documents'

Virus Scanning

🦠Scan & Delete

Automatically detect and remove infected files

typescript
1const fileUrl = await uploadcare.upload(file, {
2 filename: 'document.pdf',
3 checkVirus: true
4});
5// Infected files are automatically rejected
Server-Side Feature: This is a server-side feature powered by Uploadcare. Infected files are automatically deleted from storage to protect your users.

On-the-fly Transformations

🎨URL-Based Processing

Transform images just by changing the URL

Resize

https://ucarecdn.com/uuid/-/resize/800x600/photo.jpg

Convert Format

https://ucarecdn.com/uuid/-/format/webp/photo.jpg

Crop & Quality

https://ucarecdn.com/uuid/-/crop/300x300/center/-/quality/best/photo.jpg

Download & CDN

🌍Get CDN URL

Publicly accessible CDN link

typescript
1const downloadUrl = await uploadcare.download({
2 fileUrl: 'https://ucarecdn.com/uuid/photo.jpg'
3});

🗑️Delete File

typescript
1await uploadcare.delete({
2 fileUrl: 'https://ucarecdn.com/uuid/photo.jpg'
3});

Webhooks

Notification system for upload completion.

Auto Trigger

Server confirms automatically

typescript
1const url = await uploadcare.upload(file, {
2 filename: 'report.jpg',
3 webhook: {
4 url: 'https://myapp.com/webhooks/upload',
5 trigger: 'auto',
6 metadata: { userId: 'user_456' }
7 }
8});

👆Manual Trigger

You confirm when ready

typescript
1const url = await uploadcare.upload(file, {
2 filename: 'invoice.jpg',
3 webhook: {
4 url: 'https://myapp.com/webhooks/upload',
5 secret: 'webhook_secret_123',
6 trigger: 'manual',
7 autoConfirm: false,
8 metadata: { userId: 'user_123', uploadType: 'test' }
9 }
10});
11// Then call /webhooks/confirm to trigger delivery

Upload Cancellation

🛑Best-Effort Cancellation

Cancel uploads in progress

Cancellation is best-effort — small files on fast connections may complete before the abort takes effect.

typescript
1const abortController = new AbortController();
2
3try {
4 const uploadPromise = uploadcare.upload(largeFile, {
5 filename: 'large-photo.jpg',
6 onProgress: (progress) => {
7 if (progress > 50) abortController.abort();
8 }
9 });
10 setTimeout(() => abortController.abort(), 5000);
11 const url = await uploadPromise;
12} catch (error) {
13 if (error.name === 'AbortError') console.log('Upload cancelled');
14}

That's it!

No more manual handling.

Viruses are scanned, images are optimized, and content is distributed globally—automatically.
Focus on building your app, we handle the rest.

On this page