Module: AWS::S3::BitTorrent
- Defined in:
- lib/aws/s3/bittorrent.rb
Overview
Objects on S3 can be distributed via the BitTorrent file sharing protocol.
You can get a torrent file for an object by calling torrent_for
:
S3Object.torrent_for 'kiss.jpg', 'marcel'
Or just call the torrent
method if you already have the object:
song = S3Object.find 'kiss.jpg', 'marcel'
song.torrent
Calling grant_torrent_access_to
on a object will allow anyone to anonymously fetch the torrent file for that object:
S3Object.grant_torrent_access_to 'kiss.jpg', 'marcel'
Anonymous requests to
http://s3.amazonaws.com/marcel/kiss.jpg?torrent
will serve up the torrent file for that object.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(klass) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#grant_torrent_access ⇒ Object
Grants torrent access publicly to anyone who requests it on this object.
-
#torrent ⇒ Object
Returns the torrent file for the object.
Class Method Details
.included(klass) ⇒ Object
:nodoc:
25 26 27 |
# File 'lib/aws/s3/bittorrent.rb', line 25 def self.included(klass) #:nodoc: klass.extend ClassMethods end |
Instance Method Details
#grant_torrent_access ⇒ Object
Grants torrent access publicly to anyone who requests it on this object.
53 54 55 |
# File 'lib/aws/s3/bittorrent.rb', line 53 def grant_torrent_access self.class.grant_torrent_access_to(key, bucket.name) end |
#torrent ⇒ Object
Returns the torrent file for the object.
48 49 50 |
# File 'lib/aws/s3/bittorrent.rb', line 48 def torrent self.class.torrent_for(key, bucket.name) end |