Class Protocols.Bittorrent.Generator
- Description
Generate a .torrent binary string from files in the filesystem
- Example
// usage: thisprogram [<file/dir>] [<file/dir>...] <target .torrent> int main(int ac,array am) { Generator g=Generator(); foreach (am[1..<1];;string f) g->add(f);
string dest=am[-1]; if (-1==search(dest,"torrent")) dest+=".torrent";
Stdio.write_file(dest,g->digest()); return 0; }
- Inherit Torrent
inherit .Torrent : Torrent
- Method create
Protocols.Bittorrent.Generator Protocols.Bittorrent.Generator(
void
|string
base
,void
|int
piece_size
)- Description
Create a generator.
- Parameter
base
The base filename/path in the torrent.
- Parameter
piece_size
The size of the pieces that the SHA hashes are calculated on. Default 262144 and this value should probably be 2^n.