Gleam bindings to the Bun runtime API's
https://hex.pm/packages/bungibindies
- Gleam 72.5%
- TypeScript 27.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .forgejo/workflows | ||
| birdie_snapshots | ||
| src | ||
| test | ||
| .gitignore | ||
| biome.json | ||
| bun.lock | ||
| bunfig.toml | ||
| gleam.toml | ||
| LICENSE | ||
| manifest.toml | ||
| mise.toml | ||
| package.json | ||
| PROGRESS.md | ||
| README.md | ||
| tsconfig.json | ||
bungibindies
(incomplete) Gleam bindings to the Bun runtime API's.
WARNING - INCOMPLETE:
Please note, not everything is implemented as of yet. See the progress section for more information.
gleam add bungibindies@1
This is a little example I borrowed from the tests:
pub fn file_write_test() {
let data = "Hello world! This file is for testing writing :)"
let file = bun.file("./test/testfiles/writing.txt")
use _ <- promise.await({ file |> bun.write(data) })
// If `file_read_test()` fails, this will fail too
use read_data <- promise.await({ file |> bunfile.text() })
read_data
|> string.trim()
|> should.equal(data)
|> promise.resolve()
}}
I will be adding more examples to an example folder as I go along.
Further documentation can be found at https://hexdocs.pm/bungibindies.
Development
gleam run # Run the project
gleam test # Run the tests
Dependencies
I try to not use anything else than Bun itself,
but I do use gleam/javascript to use non-bun-specific JavaScript stuff.