Synchronous file and directory operations for Gleam on Erlang and JavaScript
open sourceApache-2.0free
simplifile is a Gleam library of synchronous operations for files and directories (read, write, append and delete, plus checks for files, directories and symlinks) with one API that works on every non-browser target: Erlang, Node, Deno and Bun. It keeps to synchronous calls so the same code runs on both Erlang and JavaScript; for streaming large files its README points to file_streams.
Problems it solves
- read and write files in Gleam code that has to run on both the BEAM and JavaScript
- do basic file operations in a Gleam script or dev tool without dealing with each target's file API
- work with files and directories from a Gleam program running on Node or Deno
Features
- read, write, append and delete files
- operations on directories as well as files
- is_file, is_directory and is_symlink checks
- one API for Erlang, Node, Deno and Bun
Limitations
- Synchronous only, so not suited where file operations are a performance bottleneck; doesn't run in the browser.1
