BitTorrent library for Pharo
locationString:= '/path/to/directoryIWantToShare' .
metainfo:=BtMetainfo new
buildOn: locationString asFileReference
announce: 'udp://open.demonii.com:1337/announce'
pieceLength: (2 raisedTo: 14).
We need to upload this file to a torrent index
metainfo writeToFile: '/path/to/myMetainfo.torrent' asFileReference .
metainfoString := '/path/to/myMetainfo.torrent'.
locationString:='/path/to/destinationFolder'.
We have to download a file .torrent from a torrent index
metainfoString:='/path/to/filesToShare.torrent'.
torrent:= BtTorrent metainfoFileString: metainfoString locationString: locationString.
localPeer:= BtLocalPeer start.
localPeer addTorrent: torrent.
torrent start.
torrent stop.
localPeer stop.