Bun
Bun — A fast all-in-one JavaScript runtime
Setup
"scripts": {
"dev": "bun run src/index.ts"
},
Fetch
const url = "..."
const response = await fetch(url, {
method: "GET",
});
const results = await response.json();
File utils
Write file
await Bun.write(path, result);
Read file
// parse json
const data = await Bun.file("embeddings.json").json();
Get dir where script is run:
import { $ } from "bun";
const getDir = async () => (await $`pwd`.text()).trim();