Crates.io | file-mumu |
lib.rs | file-mumu |
version | 0.1.5 |
created_at | 2025-07-13 16:11:26.563468+00 |
updated_at | 2025-08-16 21:44:22.180322+00 |
description | File handling function and steams plugin for the Lava language |
homepage | https://lava.nu11.uk |
repository | https://gitlab.com/tofo/mumu-file |
max_upload_size | |
id | 1750610 |
size | 81,040 |
File handling functions and streams plugin for the Lava language / Mumu engine
mumu-file
provides Lava/Mumu scripts with file reading, writing, and streaming capabilities.
It supports synchronous and streaming I/O, large file handling, and is suitable for both direct scripting and use as a dynamic plugin.
file:read
— Read files as a string or in streaming/chunked mode.file:write
— Write data, arrays, iterators, or streaming transforms to files.file:stream
— Utility for chunked streaming to stdout.Fully asynchronous at the Rust level (threaded), with Lava/Ink integration for safe, ergonomic script access.
Add to your Cargo.toml
:
[dependencies]
mumu-file = "0.1"
Clone and build (Linux example):
git clone https://gitlab.com/tofo/mumu-file.git
cd mumu-file
make
make install
This installs the libmumufile.so
plugin to /usr/local/lib/
, making it available for Lava/Mumu.
extend("file")
# Synchronous read
file:read("hello.txt", (data) => {
slog("File contents:", data)
})
# Streaming read (chunked)
file:read("bigfile.txt", file:stream)
# Synchronous write
file:write("out.txt", "Hello, world!")
# Write from array
file:write("numbers.txt", [1,2,3,4])
# Partial application
let write_hello = file:write("out.txt")
write_hello("Extra text")
# Stream-based write (see docs)
use mumu_file; // (libmumufile.so)
The plugin is loaded dynamically by Lava/Mumu via extend("file")
.
Direct usage as a Rust crate is possible for advanced users; see API docs for details.
file:read(path, callback)
file:stream
, reads in chunks (for large files).true
on start; actual results are passed to the callback.file:write(path, data)
let writer = file:write(path)
returns a function.file:stream(chunk)
Rust 1.60 or newer.
Licensed under either of:
at your option.
Tom Fotheringham tom@nu11.co.uk