s3_streamer 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/s3_streamer/downstream.rb +12 -2
- data/lib/s3_streamer/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c181c889ed6d751e84085c78387de22a1e33014
|
4
|
+
data.tar.gz: 9a2fca7fb1659498be13eb5239ab977e6a9c0ea9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8e9b881c41b52304a89cf806b08be15a104714c6ca453c9309e159263cd5e738b5b07ab4c69fc7cd1ceead81181aade618f2f664438e5d25054915d673194a2
|
7
|
+
data.tar.gz: a0ebd11a12453a721181ebc7616fff81d36f12112e45446eee6f9a1e6fea2f7fa4ab79fedf1072afefe96de2a5b56a9610b5cdea687087d7baf63941e321372c
|
@@ -5,14 +5,16 @@ module S3Streamer
|
|
5
5
|
class Downstream
|
6
6
|
DEFAULT_PART_SIZE = 10 * 1024 * 1024
|
7
7
|
|
8
|
+
attr_reader :uri
|
9
|
+
|
8
10
|
def initialize(uri, options={})
|
9
11
|
@uri = uri
|
10
12
|
@options = options
|
11
13
|
end
|
12
14
|
|
13
15
|
def each
|
14
|
-
Net::HTTP.start(
|
15
|
-
http.request
|
16
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: use_ssl) do |http|
|
17
|
+
http.request get_uri do |response|
|
16
18
|
buffer = BufferedWriter.new(min_part_size: part_size) do |part|
|
17
19
|
yield part
|
18
20
|
end
|
@@ -26,6 +28,14 @@ module S3Streamer
|
|
26
28
|
|
27
29
|
private
|
28
30
|
|
31
|
+
def use_ssl
|
32
|
+
uri.scheme == 'https'
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_uri
|
36
|
+
Net::HTTP::Get.new uri
|
37
|
+
end
|
38
|
+
|
29
39
|
def part_size
|
30
40
|
@options[:part_size] || DEFAULT_PART_SIZE
|
31
41
|
end
|
data/lib/s3_streamer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s3_streamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thilonel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.
|
128
|
+
rubygems_version: 2.5.1
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: Stream a file from a remote url using the Ruby AWS SDK to an Amazon S3 bucket.
|