storage-js icon indicating copy to clipboard operation
storage-js copied to clipboard

feat: custom-metadata, exists, info methods

Open fenos opened this issue 7 months ago • 0 comments

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

fenos avatar Jul 12 '24 07:07 fenos