Need help to fix upload/download integrations with Supabase Storage

I’m building an integration/client lib for Supabase services in Elixir, but I’m having some difficulties when it comes to uploading and downloading files from Supabase Storage.

For web requests I’ve been using finch and specifically in the case of uploads, the lib multipart.

The initial function for the upload part is defined here

the fetcher part, to make the request, can be seen in this context

As for the download, if I try to do a synchronous download, everything works fine, but I’d like to implement a lazy version that uses streams to download the file. I’ve implemented it in this way and I save the contents of that stream in this function But the file is corrupted when I download it :thinking:. I imagine that I’m receiving the chunks from the response incorrectly…

Could you shed some light on what I might be doing wrong?

There’s an open PR with the whole storage implementation: Implements basic Supabase Storage integration by zoedsoupe · Pull Request #2 · zoedsoupe/supabase · GitHub