Complete the code to generate a public URL for a stored file.
const { data } = supabase.storage.from('avatars').getPublicUrl([1]);The getPublicUrl method requires the file path inside the bucket. Here, the file is named profile.png inside the avatars bucket.
Complete the code to access the public URL from the response.
const publicUrl = data.[1];The getPublicUrl method returns an object with a publicUrl property containing the URL string.
Fix the error in the code to correctly generate a public URL for a file in a folder.
const { data } = supabase.storage.from('documents').getPublicUrl([1]);The file path should be relative to the bucket documents. So include the folder reports and the file name 2023.pdf without repeating the bucket name.
Fill both blanks to generate a public URL and log it to the console.
const { data } = supabase.storage.from('images').[1]([2]);
console.log(data.publicUrl);Use getPublicUrl method with the relative file path 'photos/sunset.jpg' inside the images bucket.
Fill all three blanks to generate a public URL for a file and assign it to a variable.
const { data } = supabase.storage.from([1]).[2]([3]);
const url = data.publicUrl;The bucket is 'avatars', the method is getPublicUrl, and the file path is 'user123.png' inside that bucket.
