SupabaseS
Supabase4mo ago
Jacob

Upload file to bucket with metadata from client side

Hey everyone!
I'm using the JavaScript library with Supabase client to upload/list/download files from client side. I would like to store custom metadata like the real filename.
Currently I upload like:

const { data, error } = await supabase.storage
  .from('bucket')
  .upload('path/file.txt', file, {
    metadata: { filename: 'My Real Filename.txt' }
  });


But when I list files, the metadata only shows system fields (eTag, size, mimetype), not my custom filename:

const { data } = await supabase.storage.from('bucket').list('folder');
console.log(data[0].metadata); // Only system metadata, no custom fields


How do I retrieve the custom metadata I uploaded? Is there a getMetadata() method or different approach needed?
Was this page helpful?