iodine/streamer.ih library provides higher-level helpers for reading files, writing strings, measuring content, copying content to another path, and removing files. It uses streamer_x86.ih internally for low-level Linux x86_64 assembly system calls.
Import
streamer in your program. The streamer_x86.ih file is an assembly backend used by the higher-level library, not the application-facing file API.Import the library
Import only the functions you need. You can expose each function to call it directly, or use@lib to keep library calls explicit.
- Expose functions
- Keep calls qualified
Functions
The library also defines helpers in the
streams namespace: open_file, close_file, exists, remove_file, read_file, and write_file. These support the functions above; prefer the top-level functions unless you specifically need a lower-level helper.
The streamer_x86.ih backend wraps Linux system calls in the streams_impl_x86 namespace:
These low-level wrappers return the raw syscall result. They are implementation details; use the top-level library functions for ordinary file operations.
Read a file
instream opens a path, reads in chunks, and returns the contents as a string:
"stderr: failed to read file"; callers should not treat that value as file contents.
Measure file contents
sizeget reads the file through instream and returns len() of the resulting string:
instream also means the current implementation does not provide a reliable negative error result through sizeget.
Write, copy, and remove
The API includesoutstream(buffer, path), steal(path, out_path), and remove(path). However, the current open_file helper opens paths with flags 0 (O_RDONLY on Linux), and outstream uses that helper before calling write. It also does not check the result of the write system call.