Skip to content

surban/webusb-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webusb-web — WebUSB on the web 🕸️

This crate provides WebUSB support in a JavaScript runtime environment, usually a web browser. It allows you to communicate with connected USB devices from a web browser.

The WebUSB API provides a way to expose non-standard Universal Serial Bus (USB) compatible devices services to the web, to make USB safer and easier to use.

This crate provides Rust support for using WebUSB when targeting WebAssembly.

MDN provides a WebUSB overview while detailed information is available in the WebUSB specification.

crates.io page docs.rs page Apache 2 license

Building

This crate depends on unstable features of the web_sys crate. Therefore you must add --cfg=web_sys_unstable_apis to the Rust compiler flags.

One way of doing this is to create the file .cargo/config.toml in your project with the following contents:

[build]
target = "wasm32-unknown-unknown"
rustflags = ["--cfg=web_sys_unstable_apis"]

License

webusb-web is licensed under the Apache 2.0 license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in webusb-web by you, shall be licensed as Apache 2.0, without any additional terms or conditions.