https://github.com/extism/extism-fsnotify
Example showing extensibility built into a file system.
https://github.com/extism/extism-fsnotify
Last synced: 7 months ago
JSON representation
Example showing extensibility built into a file system.
- Host: GitHub
- URL: https://github.com/extism/extism-fsnotify
- Owner: extism
- License: bsd-3-clause
- Created: 2022-09-02T20:15:11.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-01T05:16:33.000Z (over 2 years ago)
- Last Synced: 2025-02-02T00:46:11.532Z (over 1 year ago)
- Language: Go
- Size: 4.37 MB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# extism-fsnotify
https://user-images.githubusercontent.com/7517515/188239556-029f5142-0cb8-4bfb-a5b2-e4bbe29e25c6.mp4
Use the filesystem as a computing environment.
```sh
make build-plugins # requires Rust toolchain
make run # requires Go toolchain
```
### Demo: construct programmable directories on your filesystem.
- **`plugins/invert`**: invert the colors of a PNG file
- add a new PNG to the directory containing this .wasm plug-in
- see new PNG replacing the original with inverted colors
- **`plugins/md2html`**: convert Markdown in to HTML files
- add a Markdown file to the directory containing this .wasm plug-in
- see a new HTML file generated next to the Markdown file
The host program runs a recursive watcher, to build the initial structure, and all new directories
with files + .wasm are watched and computed.
For each file create operation, the .wasm is loaded and passed the file that triggered the event.
This program treats a directory, a written file, and a single .wasm module as the unit of computation.
### Data types
1. Host -> Plug-in
```json
{
"event_file_name": "path/to/file.md",
"event_file_data": ""
}
```
2. Plug-in -> Host
```json
{
"op": "create",
"output_file_name": "path/to/file.md",
"output_file_data": ""
}
```