deno-specific js bindings
Dependencies
| Category | API | Status | Note |
|---|---|---|---|
| Runtime | |||
| Environment Variables | env_get/set/delete/toObject | ๐งช Tested | Process environment |
| Process | cwd/exit/args | ๐งช Tested | Process information |
| File System | |||
| Read/Write Text | readTextFile/writeTextFile | ๐งช Tested | Text file operations |
| Read/Write Binary | readFile/writeFile | ๐งช Tested | Binary file operations |
| Directory | readDir/mkdir/remove | ๐งช Tested | Directory operations |
| Testing | |||
| Test Definition | test_/test_async/test_only | ๐งช Tested | Test framework |
| Permissions | |||
| Query/Request/Revoke | permissions_* | ๐งช Tested | Permission management |
| PermissionStatus | state/is_granted | ๐งช Tested | Permission state |
| Subprocess | |||
| Command | Command::new/output/outputSync/spawn | ๐งช Tested | Process spawning |
| CommandOutput | code/success/stdout/stderr | ๐งช Tested | Subprocess output |
| ChildProcess | status/output/stdin/stdout/stderr | ๐งช Tested | Spawned process |
| Planned APIs | |||
| Network | connect/listen/serve | ๐ Planned | TCP/HTTP networking |
| KV | openKv | ๐ Planned | Key-value storage |
| FFI | dlopen | ๐ Planned | Foreign function interface |
| WebGPU | Deno.gpu | ๐ Planned | GPU acceleration |
// Use Node.js fs instead of Deno's file APIs
fn example() -> Unit {
@js.run_async(fn() {
let content = @fs_promises.readFile("file.txt", "utf-8").await
@console.log(content)
})
}{
"import": [
"mizchi/js",
"mizchi/js_deno"
]
}fn main {
let d = @deno.deno()
// Environment variables
d.env_set("MY_VAR", "hello")
let value = d.env_get("MY_VAR")
// Current directory
let cwd = d.cwd()
println(cwd)
// Command line args
let args = d.args()
// File operations (async)
d.writeTextFile("test.txt", "Hello, Deno!").await()
let content = d.readTextFile("test.txt").await()
println(content)
// Permissions
let status = d.permissions_query("read", path="/tmp").await()
if status.is_granted() {
println("Read permission granted")
}
}fn main {
let d = @deno.deno()
d.test_async("file operations", fn(_ctx) {
d.writeTextFile("test.txt", "content").await()
let result = d.readTextFile("test.txt").await()
assert_eq(result, "content")
d.remove("test.txt").await()
})
}moon build --target js
deno test --allow-all target/js/release/build/mizchi/js_deno/_tests/_tests.js#external
pub type ChildProcess#external
pub type Command#external
pub type CommandOutput#external
pub type CommandStatus#external
pub type Deno#external
pub type FsFile#external
pub type PermissionStatus#external
pub type TestContextdeno-specific js bindings
Dependencies