Skip to content

yet-another-ai/takanawa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Takanawa

Takanawa is a Rust range-download library designed to ship as a C ABI dynamic library on Windows, macOS, Linux, Android, and iOS. The current implementation stores download state in a .part file with dual metadata slots so interrupted downloads can resume automatically.

Workspace

  • takanawa-core: chunk planning, .part metadata, file recovery, SHA-1/SHA-256/SHA-512/MD5/CRC32 hash checks.
  • takanawa-http: Tokio/reqwest HTTP range download engine.
  • takanawa-ffi: C ABI wrapper built as cdylib and staticlib.
  • takanawa-cli: small dogfood CLI.
  • packages/takanawa-csharp: C# SDK published as YetAnotherAI.Takanawa on NuGet for desktop .NET, Unity, Godot, Android, and iOS consumers.
  • android/takanawa-android: Kotlin-first Android SDK published as an AAR.
  • packages/takanawa-js-core: Private shared TypeScript facade bundled into npm target packages.
  • packages/takanawa-node: Node.js and Electron bindings published to npm.
  • packages/takanawa-capacitor: Capacitor plugin published to npm. The plugin ships Android and iOS bridge source and depends on the Android AAR and SwiftPM package at the same Takanawa version.
  • packages/takanawa-tauri: Tauri v2 plugin published as the takanawa-tauri npm package and the tauri-plugin-takanawa Rust crate. The frontend package uses the shared TypeScript API while the Rust plugin compiles into the host Tauri app.
  • packages/takanawa-gdextension: Godot 4 GDExtension package that exposes downloads to GDScript through a TakanawaDownload node.

Default TLS uses rustls with bundled webpki roots via the tls-rustls feature. Platform-native TLS can be selected with default-features = false and the tls-platform-native or tls-platform-roots feature. That backend uses the operating system TLS stack on Windows and macOS, and OpenSSL on Linux.

Versioning

The release version is defined in the root Cargo.toml under [workspace.package]. Gradle projects derive their group and version from that value, and crates/takanawa-core/tests/workspace_versions.rs verifies that published version references stay in sync.

To bump the release version and sync published references, run:

mise run version:sync <version>

npm

The npm GitHub Actions workflow publishes all non-private packages under packages/* when a v* tag is pushed. This includes takanawa-node, takanawa-capacitor, and takanawa-tauri. The private takanawa-js-core package is bundled into those target packages at build time and is not published separately. The workflow builds each package before pnpm publish so generated dist files and package-specific native artifacts are included in the packed tarball.

Android

The Android SDK is published as:

dependencies {
    implementation("ai.yetanother:takanawa-android:0.8.3")
}

Basic usage:

Takanawa.init()
TakanawaDownload.create(
    DownloadConfig(
        url = "https://example.com/file.bin",
        targetPath = "/data/user/0/example/cache/file.bin",
    ),
).use { download ->
    download.start()
    val snapshot = download.snapshot()
}
Takanawa.shutdown()

Build and verify the local AAR:

mise run package:android-aar

Publish to Maven local and build the smoke app against the local coordinates:

mise run publish:android-local

Maven Central releases are published from the Publish GitHub Actions workflow when a v* tag is pushed. Configure a GitHub Environment named maven-central with these secrets:

  • MAVEN_CENTRAL_USERNAME: Central Portal user token username.
  • MAVEN_CENTRAL_PASSWORD: Central Portal user token password.
  • SIGNING_IN_MEMORY_KEY: ASCII-armored private GPG key.
  • SIGNING_IN_MEMORY_KEY_ID: GPG key id.
  • SIGNING_IN_MEMORY_KEY_PASSWORD: optional GPG key password.

The release job builds the Android native libraries and runs:

./gradlew -Ptakanawa.skipRustBuild=true :takanawa-android:publishAndReleaseToMavenCentral

The Capacitor plugin does not publish a separate Maven artifact; its Android bridge is distributed in the npm package and depends on takanawa-android.

SwiftPM

The SwiftPM package is distributed as a prebuilt Takanawa.xcframework. The current Apple deployment targets are iOS 13.0, iOS Simulator 13.0, and macOS 10.15. The static XCFramework links against Apple's CoreFoundation and Security frameworks, plus libiconv.

mise run package:swiftpm
mise run test:swift-integration
mise run swiftpm:release-manifest

The checked-in Package.swift uses the local target/apple/Takanawa.xcframework path so development and CI do not need to precompute a future release checksum. Release builds generate target/swiftpm/Package.swift with the checksum for the uploaded Takanawa.xcframework.zip.

The Capacitor plugin does not publish a separate SwiftPM plugin artifact. Its iOS bridge and Takanawa.xcframework are bundled in the npm package, and packages/takanawa-capacitor/Package.swift uses the bundled binary by default.

Godot GDExtension

GDScript projects can install the takanawa-gdextension.zip release artifact and copy addons/takanawa into a Godot 4 project. The extension registers a TakanawaDownload node with progress and speed 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()

Build the host desktop GDExtension locally with:

mise run package:gdextension-desktop
mise run dist:gdextension

Godot C# projects can keep using the NuGet package below; the GDExtension target is for GDScript/native Godot consumers.

C# and NuGet

The C# SDK is published as:

<PackageReference Include="YetAnotherAI.Takanawa" Version="0.6.0" />

Basic usage:

using YetAnotherAI.Takanawa;

Takanawa.Init();
using var download = TakanawaDownload.Create(new DownloadConfig(
    url: "https://example.com/file.bin",
    targetPath: "/tmp/file.bin"));
download.Start();
var snapshot = download.Snapshot();
Takanawa.Shutdown();

The package targets netstandard2.0 and includes managed bindings plus 64-bit native runtime assets for desktop, Android, and Apple targets. Build and test locally:

mise run test:csharp

Release packing expects staged native artifacts from the release workflow:

mise run pack:csharp

C and C++

C and C++ consumers can link the C ABI library with CMake:

add_subdirectory(path/to/takanawa)
target_link_libraries(app PRIVATE Takanawa::takanawa)

The same CMake package is available through the local vcpkg overlay port:

vcpkg install takanawa --overlay-ports=/path/to/takanawa/ports

Build the CMake smoke fixture:

mise run test:cmake-integration

About

Cross-platform Download Library

Resources

License

Stars

4 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors