Deno and Bun — two other runtimes, and what differs¶
Level: 201 · for readers who use Node and have heard of Deno or Bun
Stub — an outline, not a lesson. There is no runnable example behind this page yet, so nothing on it has been through the check that backs every other claim in this library. The questions below are what the finished page has to answer.
One line: Deno, Bun and Node run the same language on different hosts: Deno refuses file, network and environment access until a flag grants it, a model Node offers only under --permission; and all three run a .ts file by dropping its types, not checking them.
Keywords: Deno, Bun, --permission, --allow-read
What the finished page will answer¶
- What does reading
/etc/hostsdo under plainnode, undernode --permission, and with--allow-fs-read=/etc/hosts? - Which flags does Deno need for a script that reads a file, calls
fetchand reads an environment variable? - What do
node file.ts,deno run file.tsandbun file.tsdo with a type error, and what dotsc --noEmitanddeno checkdo? - Which of
node:fs,Deno.readTextFileandBun.fileruns in the other two runtimes? - How do
node --test,deno testandbun testdiffer in which files they find and whether they type-check?
Examples it will need¶
-
deno_and_bun_node_permission_sh.sh— reading /etc/hosts under plain node, under --permission (ERR_ACCESS_DENIED) and with --allow-fs-read -
deno_and_bun_same_script_sh.sh— one script's output under node, deno and bun where each is installed, with its version, and a skip line where not
See also¶
- The language and the host — the language is shared; the host differs
- Running TypeScript — the way Node itself runs
.ts - The built-in test runner —
node --test, besidedeno testandbun test - Which features your Node has — checking a runtime before relying on a feature