deno.com

Use Node.js built-in modules

在 Github 上编辑

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

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());

使用 Deno CLI 在本地运行 此示例

deno run --allow-env https://docs.denohub.com/examples/scripts/node_built_in.ts

你找到需要的内容了吗?

隐私政策