send_s3_file 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/send_s3_file/version.rb +1 -1
- data/lib/send_s3_file.rb +4 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 325cd0dca93a09982d185f00716c72b18d8ff7e4
|
4
|
+
data.tar.gz: 255994aa5d9ff702b490648b55e415e1f43e7187
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ccb13ba146f764a88c9303bc58670dac167fe3466ef0907210f4ee7575176bcbb40ece2ced9f30cd5ba2e093672b1034370123da1ef9c81935cf6d0895bba61
|
7
|
+
data.tar.gz: 620111fec29c11f841b81464619b9814e55ddc986f31d7db656de89b83b7ef502440590907c7f57ea2af291293c92c260422647c19579ade7f55e0d19d70df8d
|
data/lib/send_s3_file/version.rb
CHANGED
data/lib/send_s3_file.rb
CHANGED
@@ -6,9 +6,7 @@ require "action_controller"
|
|
6
6
|
|
7
7
|
|
8
8
|
module SendS3File
|
9
|
-
def send_s3_file
|
10
|
-
s3 = AWS::S3.new
|
11
|
-
object = s3.buckets[bucket].objects[file_name]
|
9
|
+
def send_s3_file s3_object, options = {}
|
12
10
|
headers.merge!(
|
13
11
|
'Content-Type' => build_content_type(options),
|
14
12
|
'Content-Disposition' => build_disposition(options),
|
@@ -16,11 +14,11 @@ module SendS3File
|
|
16
14
|
)
|
17
15
|
|
18
16
|
render :status => options[:status], :text => Proc.new {|response, output|
|
19
|
-
logger.info "Streaming file from s3 #{bucket} #{
|
20
|
-
|
17
|
+
logger.info "Streaming file from s3 #{s3_object.bucket} #{s3_object.key}" unless logger.nil?
|
18
|
+
s3_object.read do |chunk|
|
21
19
|
output.write(chunk)
|
22
20
|
end
|
23
|
-
logger.info "Done Streaming file from s3 #{bucket} #{
|
21
|
+
logger.info "Done Streaming file from s3 #{s3_object.bucket} #{s3_object.key}" unless logger.nil?
|
24
22
|
}
|
25
23
|
end
|
26
24
|
|