AnyEvent-BitTorrent
view release on metacpan or search on metacpan
lib/AnyEvent/BitTorrent.pm view on Meta::CPAN
=head2 C<infohash( )>
Returns the 20-byte SHA1 hash of the value of the info key from the metadata
file.
=head2 C<peerid( )>
Returns the 20 byte string used to identify the client. Please see the
L<spec|/"PeerID Specification"> below.
=head2 C<port( )>
Returns the port number the client is listening on.
=head2 C<size( )>
Returns the total size of all L<files|/"files( )"> described in the torrent's
metadata.
=head2 C<name( )>
Returns the UTF-8 encoded string the metadata suggests we save the file (or
directory, in the case of multi-file torrents) under.
=head2 C<uploaded( )>
Returns the total amount uploaded to remote peers.
=head2 C<downloaded( )>
Returns the total amount downloaded from other peers.
=head2 C<left( )>
Returns the approximate amount based on the pieces we still
L<want|/"wanted( )"> multiplied by the L<size of pieces|/"piece_length( )">.
=head2 C<piece_length( )>
Returns the number of bytes in each piece the file or files are split into.
For the purposes of transfer, files are split into fixed-size pieces which are
all the same length except for possibly the last one which may be truncated.
=head2 C<bitfield( )>
Returns a packed binary string in ascending order (ready for C<vec()>). Each
index that the client has is set to one and the rest are set to zero.
=head2 C<wanted( )>
Returns a packed binary string in ascending order (ready for C<vec()>). Each
index that the client has or simply does not want is set to zero and the rest
are set to one.
This value is calculated every time the method is called. Keep that in mind.
=head2 C<complete( )>
Returns true if we have downloaded everything we L<wanted|/"wanted( )"> which
is not to say that we have all data and can L<seed|/"seed( )">.
=head2 C<seed( )>
Returns true if we have all data related to the torrent.
=head2 C<files( )>
Returns a list of hash references with the following keys:
=over
=item C<length>
Which is the size of file in bytes.
=item C<path>
Which is the absolute path of the file.
=item C<priority>
Download priority for this file. By default, all files have a priority of
C<1>. There is no built in scale; the higher the priority, the better odds a
piece from it will be downloaded first. Setting a file's priority to C<1000>
while the rest are still at C<1> will likely force the file to complete before
any other file is started.
We do not download files with a priority of zero.
=back
=head2 C<peers( )>
Returns the list of currently connected peers. The organization of these peers
is not yet final so... don't write anything you don't expect to break before
we hit C<v1.0.0>.
=head2 C<state( )>
Returns C<active> if the client is L<started|/"start( )">, C<paused> if client
is L<paused|/"pause( )">, and C<stopped> if the client is currently
L<stopped|/"stop( )">.
=head2 C<piece_cache( )>
Pieces which overlap files with zero priority are stored in a part file which
is indexed internally. To save this index (for resume, etc.) store the values
returned by this method and pass it to L<new( )|/"new( ... )">.
=head2 C<trackers( )>
Returns a list of hashes, each representing a single tier of trackers as
defined by L<BEP12|Net::BitTorrent::Protocol::BEP12>. The hashes contain the
following keys:
=over
=item C<complete>
The is a count of complete peers (seeds) as returned by the most recent
( run in 1.728 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )