Skip to main content

Use Node.js built-in modules

Deno supports most built-in Node.js modules natively - you can include them in your code using "node:" specifiers in your imports.

Edit on Github
Import the os module from core Node to get operating system info
import os from "node:os";
Use the module as you would in Node.js
console.log("Current architecture is:", os.arch());
console.log("Home directory is:", os.homedir());

Run this example locally using the Deno CLI:

deno run --allow-env https://docs.deno.com/examples/examples/node.ts

Did you find what you needed?

Privacy policy