API Docs
Takanawa exposes the same download core through Rust crates, npm packages, and native platform packages. Published Rust APIs are documented on docs.rs, while platform SDKs are distributed through npm, Maven Central, SwiftPM artifacts, and NuGet.
Rust Crates
takanawa-core: chunk planning,.partmetadata, file recovery, and hash verification.takanawa-http: Tokio and reqwest based HTTP range download engine.takanawa-ffi: C ABI wrapper for native library consumers.takanawa-cli: dogfood command-line client.
JavaScript Packages
takanawa-node: Node.js and Electron bindings built on Node-API.takanawa-capacitor: Capacitor v8 plugin for Android and iOS apps.takanawa-tauri: Tauri v2 frontend package for desktop apps, paired with thetauri-plugin-takanawaRust crate.
takanawa-node, takanawa-capacitor, and takanawa-tauri are built from the same internal TypeScript facade, so their public option names, listener handles, hash forms, phase strings, and snapshot fields stay aligned. That shared facade is bundled into each target package and is not published as a standalone npm package.
Godot GDExtension
Godot 4 projects that use GDScript can install the takanawa-gdextension.zip release artifact. It registers a TakanawaDownload node with configure/start/pause/cancel methods, polling helpers, and progress, speed, completed, failed, and cancelled signals.
var download := TakanawaDownload.new()
add_child(download)
download.progress.connect(func(snapshot: Dictionary) -> void:
print(snapshot["downloaded_bytes"])
)
download.configure({
"url": "https://example.com/file.bin",
"target_path": "user://file.bin",
})
download.start()Hash Verification
Download configurations can request final file verification with SHA-1, SHA-256, SHA-512, MD5, or CRC32. Rust callers pass a HashConfig variant, the C ABI uses hash_kind with the expected digest bytes, Android uses HashKind/expectedHash, Swift uses HashKind/expectedHash, and the JavaScript packages use hash: { kind, expected } or hash: "kind:<hex>". Existing Android, Swift, and JavaScript expectedSha256/sha256 shortcuts continue to select SHA-256.
Digest byte lengths are SHA-1 = 20, SHA-256 = 32, SHA-512 = 64, MD5 = 16, and CRC32 = 4 bytes. CRC32 is represented in standard big-endian hexadecimal order (for example, 352441c2 becomes bytes 35 24 41 c2).
Native Interfaces
The public C header is generated from takanawa-ffi:
mise run headerAndroid consumers use the Kotlin-first SDK:
dependencies {
implementation("ai.yetanother:takanawa-android:0.8.3")
}
val download = TakanawaDownload.create(config)
download.setProgressCallback { snapshot ->
println("${snapshot.phase}: ${snapshot.downloadedBytes}/${snapshot.contentLen}")
}
download.setSpeedCallback { snapshot ->
println("${snapshot.bytesPerSecond} B/s")
}
download.start()Apple consumers use the SwiftPM package and prebuilt Takanawa.xcframework.
let download = try TakanawaDownload.create(config)
try download.setProgressCallback { snapshot in
print("\(snapshot.phase): \(snapshot.downloadedBytes)/\(snapshot.contentLen)")
}
try download.setSpeedCallback { snapshot in
print("\(snapshot.bytesPerSecond) B/s")
}
try download.start()C# consumers use the YetAnotherAI.Takanawa NuGet package.
using YetAnotherAI.Takanawa;
using var download = TakanawaDownload.Create(config);
download.SetProgressCallback(snapshot =>
Console.WriteLine($"{snapshot.Phase}: {snapshot.DownloadedBytes}/{snapshot.ContentLen}"));
download.SetSpeedCallback(snapshot =>
Console.WriteLine($"{snapshot.BytesPerSecond} B/s"));
download.Start();C ABI consumers can register a nullable TknwProgressCallback with tknw_download_set_progress_callback and a nullable TknwSpeedCallback with tknw_download_set_speed_callback. Passing NULL clears the callback. C and C++ projects can link the native library through the CMake target Takanawa::takanawa or through the local vcpkg overlay port.
Local Rustdoc
Generate local Rust API documentation with Cargo:
cargo doc --workspace --all-features --no-depsThe generated docs are written under target/doc.