Skip to content

fetch file from other cloud store. #647

@falstack

Description

@falstack

Feature request

When I use OAuth to get users' avatars on social platforms, I need to store them in my storeage, otherwise I can't access them (next/image restrictions or users change new avatars)

Describe the solution you'd like

supabase.fetch('https://useravatar.png').to({
   bucket: 'my-bucket',
   path: 'filepath'
})

Describe alternatives you've considered

Use Nodejs to download remote files to local, and then upload them using supabase

Additional context

  1. supabase can provide syntax encapsulation to download remote files to local
  2. When calling the remote download, supabase does not need to download the remote file to the local, but calls the cloud function of supabase to push the file to the user's bucket

Activity

soedirgo

soedirgo commented on Nov 30, 2022

@soedirgo
Member

Hmm, I think this is a bit out of scope for the client library. You can try fetching the image and storing them with from().upload(), e.g.

const res = await fetch("https://example.com/avatar.png")
const { data, error } = await supabase.from('bucket').upload('file/path.png', await res.blob())

cc @fenos

falstack

falstack commented on Dec 3, 2022

@falstack
Author

@soedirgo
local fetch very slowly and dangerous for io, this service should work on cloud, like: https://github.com/qiniu/qshell/blob/master/docs/fetch.md

falstack

falstack commented on Dec 10, 2022

@falstack
Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @falstack@soedirgo

        Issue actions

          fetch file from other cloud store. · Issue #647 · supabase/supabase-js