Fields and methods of the jala.BitTorrent class.
Constructs a new BitTorrent file.
parameters
String | trackerUrl | The URL string of the tracker. |
String | filePath | The path to the original file. |
methods
- keys()
- get(name)
- set(name, value)
- setCreationDate(date)
- setPieceLength(length)
- save(filename)
- toString()
Methods
Get a torrent property.
parameters
String | name | The name of the property. |
returns
The value of the property. |
Set a torrent property.
parameters
String | name | The name of the property. |
Object | value | The property's value. |
Get the creation date of the torrent.
returns
The torrent's creation date. |
Set the creation date of the torrent.
parameters
Date | date | The desired creation date. |
Get the piece length of the torrent.
returns
The torrent's piece length. |
Set the piece length of the torrent.
parameters
Number | length | The desired piece length. |
Saves the torrent as file.
parameters
String | filename | An optional name for the torrent file. If no name is given it will be composed from name of source file as defined in the torrent plus the ending ".torrent". |
Get a string representation of the torrent.
returns
The torrent as string. |
The bencode method. Turns an arbitrary JavaScript
object structure into a corresponding encoded
string.
parameters
Object | obj | The target JavaScript object. |
returns
The encoded string. |
The bdecode method. Turns an encoded string into
a corresponding JavaScript object structure.
FIXME: Handle with caution...
parameters
String | code | The encoded string. |
returns
The decoded JavaScript structure. |