āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/nic13gamer/better-upload/helpers-server ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
<PageSelect pages={[ { href: '/docs/helpers-server', title: 'Server-side', description: 'Helpers for your server.', }, { href: '/docs/helpers-client', title: 'Client-side', description: 'Helpers for your frontend.', }, ]} />
Better Upload has some built-in clients for popular S3-compatible storage services, like Cloudflare R2. Suggest a new client by opening an issue.
import { cloudflare } from 'better-upload/server/helpers';
const client = cloudflare({
accountId: 'your-account-id',
accessKeyId: 'your-access-key-id',
secretAccessKey: 'your-secret-access-key',
});
const jurisdictionClient = cloudflare({
accountId: 'your-account-id',
accessKeyId: 'your-access-key-id',
secretAccessKey: 'your-secret-access-key',
jurisdiction: 'eu', // If you created your R2 bucket using a jurisdiction.
});
import { minio } from 'better-upload/server/helpers';
const client = minio({
region: 'your-minio-region',
endpoint: 'https://minio.example.com',
accessKeyId: 'your-access-key-id',
secretAccessKey: 'your-secret-access-key',
});
import { tigris } from 'better-upload/server/helpers';
const client = tigris({
accessKeyId: 'your-access-key-id',
secretAccessKey: 'your-secret-access-key',
endpoint: '...', // Optional
});
import { backblaze } from 'better-upload/server/helpers';
const client = backblaze({
region: 'your-backblaze-region',
applicationKeyId: 'your-application-key-id',
applicationKey: 'your-application-key',
});
import { wasabi } from 'better-upload/server/helpers';
const client = wasabi({
region: 'your-wasabi-region',
accessKeyId: 'your-access-key-id',
secretAccessKey: 'your-secret-access-key',
});
import { digitalOcean } from 'better-upload/server/helpers';
const client = digitalOcean({
region: 'your-spaces-region',
key: 'your-spaces-key',
secret: 'your-spaces-secret',
});
<Callout>
All clients return an S3 client from the AWS SDK, just like `new S3Client()`,
but already configured for that service.
</Callout>
Moves an object from one location to another, within the same bucket. Also known as renaming.
import { moveObject } from 'better-upload/server/helpers';
await moveObject({
client: s3,
bucketName: 'my-bucket',
objectKey: 'example.jpg',
destinationKey: 'images/example.jpg',
});
<Callout type="warn">
This copies the object to the new location and then deletes the original
object. It can be slow.
</Callout>ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā