Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
fix compose wasm read
Browse files Browse the repository at this point in the history
  • Loading branch information
noise64 committed Nov 14, 2024
1 parent 7c5d0d4 commit 5d961b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion wasm-rpc-stubgen/src/commands/composition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub async fn compose(

let mut graph = CompositionGraph::new();

let socket = fs::read_to_string(source_wasm).context("Failed to read socket component")?;
let socket = fs::read(source_wasm).context("Failed to read socket component")?;

let socket = Package::from_bytes("socket", None, socket, graph.types_mut())?;
let socket = graph.register_package(socket)?;
Expand Down
5 changes: 5 additions & 0 deletions wasm-rpc-stubgen/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ pub fn read_to_string<P: AsRef<Path>>(path: P) -> anyhow::Result<String> {
.with_context(|| anyhow!("Failed to read to string, file: {}", path.display()))
}

pub fn read<P: AsRef<Path>>(path: P) -> anyhow::Result<Vec<u8>> {
let path = path.as_ref();
std::fs::read(path).with_context(|| anyhow!("Failed to read file: {}", path.display()))
}

// Creates all missing parent directories if necessary and writes str to path.
pub fn write_str<P: AsRef<Path>, S: AsRef<str>>(path: P, str: S) -> anyhow::Result<()> {
let path = PathExtra(path);
Expand Down

0 comments on commit 5d961b5

Please sign in to comment.