Skip to content

Deno

Installation

brew install deno

Example - Hello World

deno run https://deno.land/std/examples/welcome.ts

Example - TCP Listener

import { serve } from "https://deno.land/std@0.50.0/http/server.ts";
const s = serve({ port: 8000 });
console.log("http://localhost:8000/");
for await (const req of s) {
  req.respond({ body: "Hello World\n" });
}

Run with the following: deno run --allow-net index.js

Example - Watching file system events

const watcher = Deno.watchFs("/");
for await (const event of watcher) {
  console.log(">>>> event", event);
  // { kind: "create", paths: [ "/foo.txt" ] }
}

Run with the following: deno run --allow-read filesystem.js

Libraries

Resources