Sanko Robinson


Net::BitTorrent::Torrent::File - BitTorrent File I/O Class


new ( { [ARGS] } )

Creates a Net::BitTorrent::Torrent::File object. This constructor should not be used directly.


index ( )

Returns the zero based index of this file according to the related Net::BitTorrent::Torrent object's file list.

mode ( )

Returns a value representing if and how the related file handle is open. Possible values:

    'ro'    - Read only
    'wo'    - Write only
    'rw'    - Read and Write
    undef   - Closed
path ( )

Returns the absolute path of the related file.

priority ( )

Returns the download priority of this file.

See also: set_priority ( )

set_priority ( NEWVAL )

Sets the download priority of this file.

By default, all files begin with a level two (2) priority with the intent being on a 0 (skip), 1 (low), 2 (normal), 3 (high) priority scale but you may use any scale you want. For example, you could set a file's priority to say... 1,000,000, leave everything else at the default 2 and and be positive we'll work on it first. To avoid downloading this file, set priority to 0.

See also: priority ( )

NOTE: Setting the priority to 0 will tell Net::BitTorrrent not to bother requesting these pieces however, the file will still be created on disk if a piece we want overlaps onto this file. Just give me some time to work on an intermediate .piece file and this problem will go away.

torrent ( )

Returns the Net::BitTorrent::Torrent object related to this file.

size ( )

Returns the size of the file represented by this object.

as_string ( [ VERBOSE ] )

Returns a 'ready to print' dump of the object's data structure. If called in void context, the structure is printed to STDERR. VERBOSE is a boolean value.


Sanko Robinson <> -


License and Legal

Copyright (C) 2008-2009 by Sanko Robinson <>

This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or For clarification, see

When separated from the distribution, all POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See For clarification, see

Neither this module nor the Author is affiliated with BitTorrent, Inc.