torrent_model 1.0.1 copy "torrent_model: ^1.0.1" to clipboard
torrent_model: ^1.0.1 copied to clipboard

outdated

A Dart library for parsing .torrent file to Torrent model/saving Torrent model to .torrent file.

example/torrent_model_example.dart

import 'package:torrent_model/torrent_model.dart';

void main() async {
  readAndSave('example/sample.torrent', 'example/sample2.torrent');
  readAndSave('example/sample3.torrent', 'example/sample4.torrent');
}

void readAndSave(String path, String newPath) async {
  var result = await Torrent.parse(path);
  printModelInfo(result);
  var newFile = await result.saveAs(newPath, true);
  var result2 = await Torrent.parse(newFile.path);
  printModelInfo(result2);
}

void printModelInfo(Torrent model) {
  print('${model.filePath} Info Hash : ${model.infoHash}');
  print('${model.filePath} announces :');
  for (var announce in model.announces) {
    print('${announce}');
  }

  print('${model.filePath} files :');
  for (var file in model.files) {
    print('${file}');
  }
}
1
likes
30
pub points
35%
popularity

Publisher

unverified uploader

A Dart library for parsing .torrent file to Torrent model/saving Torrent model to .torrent file.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

bencode_dart, crypto

More

Packages that depend on torrent_model