tokio-fs-ext
Tokio-fs-ext is a Rust library that provides a tokio::fs compatible API for both native and WebAssembly (wasm32-unknown-unknown) environments.
Overview
The standard tokio::fs module in the Tokio runtime is a powerful tool for asynchronous file system operations. However, it relies on blocking syscalls an I/O operations that are executed on a dedicated thread pool. This design is not suitable for WebAssembly environments where threading and direct file system access are restricted.
This library aims to bridge that gap by offering an API that is compatible with tokio::fs but works seamlessly in WASM. It provides a consistent interface for file system operations, regardless of the target platform.
Features
- A
tokio::fs-like API. - Reuse
tokio::fson native platforms, and use implementations byOPFSonwasm32-unknown-unknownplatform. - Asynchronous file operations for non-blocking applications.
Usage
use tokio_fs_ext as fs;
use io;
async
Clarification
- The implements for WebAssembly can only be used in
DedicatedWorkerGlobalScope.
Contributing
Testing