torrent 0.0.1+1

  • Readme
  • Changelog
  • Example
  • Installing
  • new11

[WIP, This library is currently under heavy development and isn't ready for production]

Usage #

Example:

import 'package:logging/logging.dart';
import 'package:torrent/torrent.dart';
import 'package:torrent/auxlib.dart';

main() async {
  BtLog.setLevel(Level.FINER);

  final info = await loadFile('test/data/hot.torrent');
  dumpInfo(info, brief: true);

  final agent = BtAgentCore();
  final torrent = agent.addTorrent(info);

  await torrent.verifyLocalData();
  print(torrent.percent() * 100);
  print(torrent.absentPieces());

  torrent.startAllTrackers();
  torrent.downloadAll();
}

BEPs #

Implemented #

Partially implemented #

Planned #

Roadmap to v0.1 #

  • UPnP
  • NAT-PMP

Experimental tracker server #

TBD

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Lisence #

The MIT License (MIT)

Copyright (c) 2019 xuty

0.0.1+1 #

  • Update readme

0.0.1 #

  • Initial version, created by Stagehand

example/torrent_example.dart

import 'package:logging/logging.dart';
import 'package:torrent/torrent.dart';
import 'package:torrent/auxlib.dart';

main() async {
  BtLog.setLevel(Level.FINER);

  final info = await loadFile('test/data/hot.torrent');
  dumpInfo(info, brief: true);

  final agent = BtAgentCore();
  final torrent = agent.addTorrent(info);

  await torrent.verifyLocalData();
  print(torrent.percent() * 100);
  print(torrent.absentPieces());

  torrent.startAllTrackers();
  torrent.downloadAll();
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  torrent: ^0.0.1+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:torrent/torrent.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
54
Overall:
Weighted score of the above. [more]
11
Learn more about scoring.

We analyzed this package on Oct 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms:

Low code quality prevents platform classification.

Health issues and suggestions

Fix lib/src/create.dart. (-97.62 points)

Analysis of lib/src/create.dart failed with 13 errors, including:

line 7 col 8: Target of URI doesn't exist: 'spec.dart'.

line 8 col 8: Target of URI doesn't exist: 'info.dart'.

line 11 col 8: The name 'TorrentSpec' isn't a type so it can't be used as a type argument.

line 21 col 8: The name 'TorrentSpec' isn't a type so it can't be used as a type argument.

line 34 col 16: The function 'TorrentInfo' isn't defined.

Fix lib/src/metainfo/bt_metainfo.dart. (-68.52 points)

Analysis of lib/src/metainfo/bt_metainfo.dart failed with 4 errors, 1 hint:

line 3 col 8: Target of URI doesn't exist: 'package:meta/meta.dart'.

line 7 col 5: Undefined name 'required' used as an annotation.

line 9 col 5: Undefined name 'required' used as an annotation.

line 11 col 5: Undefined name 'required' used as an annotation.

line 1 col 8: Unused import: 'package:torrent/src/hash.dart'.

Fix lib/src/tracker/bt_tracker_wire_udp.dart. (-68.36 points)

Analysis of lib/src/tracker/bt_tracker_wire_udp.dart failed with 4 errors:

line 6 col 8: Target of URI doesn't exist: 'package:meta/meta.dart'.

line 64 col 5: Undefined name 'required' used as an annotation.

line 65 col 5: Undefined name 'required' used as an annotation.

line 70 col 5: Undefined name 'required' used as an annotation.

Fix additional 32 files with analysis or formatting issues. (-133.32 points)

Additional issues in the following files:

  • lib/src/metainfo/bt_file.dart (3 errors)
  • lib/src/metainfo/bt_info.dart (2 errors, 1 hint)
  • lib/src/tracker/bt_tracker_wire_http.dart (1 error)
  • lib/src/tracker/bt_tracker_agent.dart (5 hints)
  • lib/src/peer/bt_peer.dart (2 hints)
  • lib/src/peer/protocol/message.dart (2 hints)
  • lib/src/peer/bt_bitfield.dart (1 hint)
  • lib/src/peer/bt_peer_half.dart (1 hint)
  • lib/src/peer/protocol/reader.dart (1 hint)
  • lib/src/tracker/bt_tracker.dart (1 hint)
  • lib/auxlib.dart (Run dartfmt to format lib/auxlib.dart.)
  • lib/src/announce/bt_announce.dart (Run dartfmt to format lib/src/announce/bt_announce.dart.)
  • lib/src/announce/bt_announce_event.dart (Run dartfmt to format lib/src/announce/bt_announce_event.dart.)
  • lib/src/announce/bt_announce_result.dart (Run dartfmt to format lib/src/announce/bt_announce_result.dart.)
  • lib/src/bencode/bencode.dart (Run dartfmt to format lib/src/bencode/bencode.dart.)
  • lib/src/metainfo/bt_encoder.dart (Run dartfmt to format lib/src/metainfo/bt_encoder.dart.)
  • lib/src/metainfo/bt_parser.dart (Run dartfmt to format lib/src/metainfo/bt_parser.dart.)
  • lib/src/peer/bt_peer_data.dart (Run dartfmt to format lib/src/peer/bt_peer_data.dart.)
  • lib/src/peer/bt_peer_event.dart (Run dartfmt to format lib/src/peer/bt_peer_event.dart.)
  • lib/src/peer/bt_pex.dart (Run dartfmt to format lib/src/peer/bt_pex.dart.)
  • lib/src/peer/peer_id.dart (Run dartfmt to format lib/src/peer/peer_id.dart.)
  • lib/src/peer/protocol/exception.dart (Run dartfmt to format lib/src/peer/protocol/exception.dart.)
  • lib/src/peer/protocol/reserved.dart (Run dartfmt to format lib/src/peer/protocol/reserved.dart.)
  • lib/src/server/tracker_server.dart (Run dartfmt to format lib/src/server/tracker_server.dart.)
  • lib/src/storage/bt_storage.dart (Run dartfmt to format lib/src/storage/bt_storage.dart.)
  • lib/src/torrent/bt_request.dart (Run dartfmt to format lib/src/torrent/bt_request.dart.)
  • lib/src/tracker/bt_crawler_result.dart (Run dartfmt to format lib/src/tracker/bt_crawler_result.dart.)
  • lib/src/tracker/bt_tracker_wire.dart (Run dartfmt to format lib/src/tracker/bt_tracker_wire.dart.)
  • lib/src/util/ipv4.dart (Run dartfmt to format lib/src/util/ipv4.dart.)
  • lib/src/util/range.dart (Run dartfmt to format lib/src/util/range.dart.)
  • lib/src/utils.dart (Run dartfmt to format lib/src/utils.dart.)
  • lib/torrent.dart (Run dartfmt to format lib/torrent.dart.)

Document public APIs. (-0.53 points)

62 out of 63 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance issues and suggestions

Fix platform conflicts. (-20 points)

Low code quality prevents platform classification.

The package description is too short. (-16 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
ansicolor ^1.0.0 1.0.2
async ^2.3.0 2.4.0
base32 ^1.0.0 1.0.1
collection ^1.0.0 1.14.12
easy_udp ^1.2.0 1.2.0
logging ^0.11.0 0.11.3+2
path ^1.6.0 1.6.4
torrent_bencode ^0.1.0 0.1.0+1
torrent_parser ^1.2.0 1.2.0
Transitive dependencies
charcode 1.1.2
convert 2.1.1
crypto 2.1.3
json_annotation 2.4.0 3.0.0
typed_data 1.1.6
Dev dependencies
pedantic ^1.0.0
test ^1.0.0