loki
0.5.4indexedEnables downloading of magnet URIs with optimized memory usage and performance for mobile contexts. Features a small, efficient footprint suitable for web and Android applications.
1
Stars
—
Used by
dependents
—
Health
/ 100
Enables downloading of magnet URIs with optimized memory usage and performance for mobile contexts. Features a small, efficient footprint suitable for web and Android applications.
Surfaced from shared tags and platforms — no rankings paid for.
The Loki Bittorrent library implements the download of magnet URIs.
The implemented DHT based on Mainline DHT. The specification can be found here Bittorrent.
kotlin {
sourceSets {
commonMain.dependencies {
...
implementation("io.github.remmerw:loki:0.5.4")
}
...
}
}
: = runBlocking(Dispatchers.IO) {
uri =
magnetUri = parseMagnetUri(uri)
cacheDir = SystemTemporaryDirectory
storage =
download(magnetUri, cacheDir) { torrentState: State ->
completePieces = torrentState.piecesComplete
totalPieces = torrentState.piecesTotal
println()
}
dataDir = Path( cacheDir, magnetUri.displayName ?: )
SystemFileSystem.createDirectories(dataDir)
storage.storeTo(dataDir)
storage.finish()
}