Class: S3Streamer::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Client

Returns a new instance of Client.



10
11
12
# File 'lib/s3_streamer/client.rb', line 10

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

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



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

def client
  @client
end

Instance Method Details

#stream(source_uri, bucket, destination_file, options = {}) ⇒ Object



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

def stream(source_uri, bucket, destination_file, options={})
  upstream = Upstream.new client, bucket, destination_file

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

  upstream.complete
end