bungibindies
Gleam bindings to the Bun runtime API’s.
WARNING:
Please note, only the utils part is finished so far. I published it so that I could try it out though.
gleam add bungibindies@1
import bungibindies/bun
import bungibindies/bun/serve
pub fn main() {
bun.serve(fn () {
serve.fetch(req: Request) {
Response("Success!")
},
})
}
(This is a rough sketch cuz I’m just making code up rn)
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.
Implementation
Boxes are checked when the implementation is usable, if it’s not
complete but checked, should be in the skipped
section along
with possibly the reason for skipping.
-
HTTP API’s
-
HTTP server
-
Bun.serve()
,serve.fetch()
and alike - WebSocket server
-
-
HTTP client
- `Bun.fetch()
-
HTTP server
-
Workers
-
Binary data
- Types
-
Streams
- Stream types
-
File I/O
-
Reading (
Bun.file()
)-
Bun.stdin
-
Bun.stdout
-
Bun.stderr
-
-
Writing (
Bun.write()
)
-
Reading (
-
import.meta
-
SQLite
-
New
returning aBun.Database
in the form of a set of functions and interfaces.
-
-
Globals
-
$ Shell – if possible to implement
-
Child processes
-
Bun.spawn()
-
Bun.exec()
-
Bun.execSync()
-
Bun.spawnSync()
-
-
TCP
-
Bun.listen()
-
Bun.connect()
-
-
Transpiler
-
New
returning aBun.Transpiler
in the form of a set of functions and interfaces.
-
-
Hashing
-
Bun.password_hash()
andBun.password_verify()
-
Bun.hash()
-
-
Console
-
FFI
-
HTMLRewriter
-
Testing
-
Utils
-
Bun.version
-
Bun.revision
-
Bun.env
-
Bun.main
-
Bun.sleep()
-
Bun.sleepSync()
-
Bun.which()
-
Bun.randomUUIDv7()
-
Bun.peek()
-
Bun.openInEditor()
-
Bun.deepEquals()
-
Bun.escapeHTML()
-
Bun.stringWidth()
-
Bun.fileURLToPath()
-
Bun.pathToFileURL()
Bun.gzipSync
Bun.gunzipSync
Bun.deflateSync
Bun.inflateSync
-
Bun.inspect()
-
Bun.nanoseconds()
Bun.readableStreamTo*()
-
Bun.resolveSync()
serialize
&deserialize
inbun:jsc
-
-
DNS
Skipped
Some implementations were skipped for now. Here is a little list of what I skipped. If you want to help, feel free to implement them and make a PR, or wait until I get to them :)
- Utilities ->
Bun.gzipSync
: Not sure how to implement this yet. - Utilities ->
Bun.gunzipSync
: Not sure how to implement this yet. - Utilities ->
Bun.deflateSync
: Not sure how to implement this yet. - Utilities ->
Bun.inflateSync
: Not sure how to implement this yet. - Utilities ->
Bun.readableStreamTo*()
: Not sure how to implement this. - Utilities ->
serialize
&deserialize
inbun:jsc
: Not sure how to implement this. - Console: Not sure how to implement this yet.
- DNS: Not stable enough yet.
import.meta
: Gleam modules are not accessible from Bun API’s, maybe through source maps in the future.- Workers: Not stable enough yet.