Storage Operations (sdk.storage)
Managed file storage optimized for the edge.
Introduction
import { AerostackServer } from '@aerostack/sdk';
const sdk = new AerostackServer(env);
const url = await sdk.storage.upload(file, 'key');Features
upload(file, key, options)
Upload files (Stream, Buffer, or String).
// From request body
const file = await request.arrayBuffer();
const result = await sdk.storage.upload(file, `uploads/${userId}/avatar.jpg`, {
contentType: 'image/jpeg'
});
console.log(result.url); // Public URLgetUrl(key)
Get public URL for a file.
const url = await sdk.storage.getUrl('uploads/profile.png');list(prefix)
List files in a bucket folder.
const files = await sdk.storage.list('uploads/user_123/');
// [{ key: '...', size: 1024, ... }]delete(key)
Delete a file permanently.
await sdk.storage.delete('uploads/old-file.txt');⚠️
Ensure [[r2_buckets]] is bound to STORAGE in aerostack.toml.
For public access, configure custom domain or allow public R2 bucket access.