Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dphilla/marcotte
from the French, "Layering"
https://github.com/dphilla/marcotte
Last synced: 4 days ago
JSON representation
from the French, "Layering"
- Host: GitHub
- URL: https://github.com/dphilla/marcotte
- Owner: dphilla
- License: other
- Created: 2023-03-31T12:36:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-06-29T02:46:52.000Z (over 1 year ago)
- Last Synced: 2024-04-08T02:31:35.177Z (7 months ago)
- Language: Rust
- Homepage:
- Size: 27.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-webassembly - dphilla/marcotte-wasm
README
# marcotte-wasm
Create Layers of host-agnostic system functionality for your WebAssembly (Wasm) application.
(Currently supports Filesystem Layers)
## Example Usage
Take this rust code:
```rust
use std::fs;pub fn scale(ctx: &mut Context) -> Result<&mut Context, Box> {
let filename = "example.txt".to_string();// open()
let mut file = File::open(&filename).expect("Unable to open file");let s = "\n\n\n We are interacting with a filesystem!!!\n\n\n";
let bytes = s.as_bytes();
// write()
file.write(&bytes);// read()
let contents = file.read_to_string()?;ctx.response().set_body(format!("\nfile: {} ", contents));
Ok(ctx)
// close()
}
```
This will not be able to run in Core Wasm, because it relies on underlying libc interfaces, and syscalls provided by a kernel. `marcotte` (aliased: `mwasm`) can create these layers in pure webassembly, and allow your program to run (mostly) as if it were compiled to a native platform.Running `mwasm open read write close --full` Will generate everything this code needs to run, in a pure WebAssembly Environment.
## How it works
This cli relies on [wasm-vfs](https://github.com/dphilla/wasm-vfs) and [wasm-libc](https://github.com/dphilla/wasm-libc) to create the libc interface layer, and the "Syscall" functionality all within a consumable Wasm Component.
## Installation
clone and `cargo build --release` and drop the generated binary in your /usr/bin (or, your preferred) directory.
## Limitations
Many, as **this is a work-in-progress, experimental tool**, but notably:
- Networking Layers
- Size Limitations
- Complete Filesystem AbstractionsPlease see the repo's [issues](https://github.com/dphilla/marcotte-wasm/issues) for more information on these.