Class: S3Streamer::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/s3_streamer/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Client

Returns a new instance of Client.



8
9
10
# File 'lib/s3_streamer/client.rb', line 8

def initialize(options)
  @client = Aws::S3::Client.new(options)
end

Instance Method Details

#stream(source_uri, bucket, destination_file) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/s3_streamer/client.rb', line 12

def stream(source_uri, bucket, destination_file)
  upstream = Upstream.new @client, bucket, destination_file

  Downstream.new(URI(source_uri)).each do |chunk|
    upstream.upload chunk
  end

  upstream.complete
end