async-sync-bridge

Bridge async streams to sync I/O for blocking libraries.

1|Updated Nov 25, 2025
One-click install
npx skills add https://github.com/89jobrien/dotfiles --skill async-sync-bridge
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: async-sync-bridge
Source: https://github.com/89jobrien/dotfiles/tree/main/dot-claude/skills/async-sync-bridge
Command: npx skills add https://github.com/89jobrien/dotfiles --skill async-sync-bridge

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Bridge async streams to synchronous Read I/O for blocking libraries.

Core Features & Use Cases

  • Bridge async streams to sync Read by using SyncIoBridge inside spawn_blocking.
  • Preserve Tokio runtime context by capturing Handle::current() before entering blocking code.
  • Integrates with common blocking I/O libraries like tar, flate2, and zip.

Quick Start

Bridge an async byte stream to a synchronous Read by wrapping it with SyncIoBridge inside a blocking task.

Frequently Asked Questions about async-sync-bridge

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I bridge async streams to sync I/O for blocking libraries in Tokio?

To bridge async streams to sync I/O, wrap the stream with SyncIoBridge inside a spawn_blocking task. This allows blocking libraries expecting synchronous Read to consume bytes from Tokio streams safely.

Why does my Tokio runtime panic when passing async streams to blocking libraries?

Tokio runtime panics occur when async context is lost in blocking code. Capture Handle::current() before spawn_blocking to preserve the Tokio runtime context and allow the sync bridge to function correctly.

Can I use async streams with blocking libraries like tar, flate2, or zip?

Yes, you can use async streams with tar, flate2, or zip by using SyncIoBridge. This bridges the async stream into a synchronous Read interface compatible with these blocking I/O libraries.

What's the best way to stream bytes into a sync reader without blocking the async runtime?

The best way to stream bytes into a sync reader is using SyncIoBridge within spawn_blocking. This isolates the blocking I/O operations from the async executor while maintaining stream continuity.

Do I need to capture Handle::current() before using spawn_blocking for sync I/O bridging?

Yes, capturing Handle::current() is mandated before spawn_blocking to preserve the Tokio runtime context. This ensures the synchronous bridge can safely interact with the async stream.