storage-js
storage-js copied to clipboard
feat: custom-metadata, exists, info methods
What kind of change does this PR introduce?
Feature
What is the new behavior?
Custom Metadata
Adds support for custom metadata on objects:
const res = await storage.from(bucketName).upload(uploadPath, file, {
metadata: {
custom: 'metadata',
second: 'second',
third: 'third',
},
})
Exists / Info
added 2 new methods, exists and info
Info fetches the information about this object
const {data: obj} = await storage.from(bucketName).info(uploadPath)
obj.id
obj.metadata
Exists Check if a file exists
const {data: exists} = await storage.from(bucketName).exists(uploadPath)
console.log(exists) // true / false
Relates to https://github.com/supabase/storage/issues/439