Thanks for the feedback @Dohomi! The ordering isn’t actually random - Vercel Blob returns blobs sorted lexicographically by pathname (like dictionary order), which can appear random when filenames don’t follow a predictable pattern.
Unfortunately, sorting by uploadedAt isn’t possible at the storage level, so if you want that you need to work around this limitation.
Workaround: Include timestamps in your blob pathnames for chronological sorting:
import { put } from "@vercel/blob";
// Include ISO timestamp for chronological order
const timestamp = new Date().toISOString(); // 2024-06-03T10:30:00.000Z
const blob = await put(`${timestamp}-filename.jpg`, file, { access: 'public' });
When you list() blobs with this naming pattern, they’ll automatically sort chronologically (newest first if you want reverse order, manipulate the timestamp).
Alternatively, you can sort client-side after retrieval:
const res = await list();
const sortedBlobs = res.blobs.sort((a, b) => new Date(b.uploadedAt) - new Date(a.uploadedAt));