Class: Supabase::Storage::Async::Client

Inherits:
Client show all
Defined in:
lib/supabase/storage/async/client.rb

Overview

Async counterpart to Client.

Inherits the full public surface (list_buckets, get_bucket, create_bucket, update_bucket, empty_bucket, delete_bucket, from/bucket → FileApi) and rewires only the Faraday adapter to async-http-faraday so HTTP I/O yields back to the Async reactor instead of blocking the thread.

BucketApi and FileApi are transport-agnostic — they speak to whatever Faraday connection the client hands them, so neither has an async twin.

Call sites must run inside an ‘Async do … end` block; outside one, the adapter still works but loses the concurrency win.

require "supabase/storage/async"
require "async"

storage = Supabase::Storage::Async::Client.new(
  base_url: "https://project.supabase.co/storage/v1",
  headers:  { "apikey" => key }
)

Async do |task|
  uploads = files.map do |f|
    task.async { storage.from("avatars").upload(f.name, f.bytes) }
  end
  uploads.map(&:wait)
end

Instance Attribute Summary

Attributes inherited from Client

#base_url, #headers

Method Summary

Methods inherited from Client

#analytics, #from, #initialize, #vectors

Methods inherited from BucketApi

#create_bucket, #delete_bucket, #empty_bucket, #get_bucket, #initialize, #list_buckets, #update_bucket

Constructor Details

This class inherits a constructor from Supabase::Storage::Client