fs or path out of the box. Why is this the case?Deno was designed to be secure and compatible with browser standards. It uses ES modules and does not include Node.js built-in modules to avoid legacy dependencies and security issues.
crypto. What happens and how can you work around it?Deno does not include Node.js built-in modules by default. When npm packages rely on them, errors occur. Developers can use shims or polyfills to provide similar functionality.
import { readFileSync } from "fs";
console.log(readFileSync("./data.txt", "utf8"));
What error will Deno show and why?Deno does not include Node.js built-in modules like fs. Importing from "fs" causes a module not found error.
lodash in Deno. Which import statement is correct assuming you use Deno's npm compatibility?Deno supports npm packages with the npm: prefix. Using import _ from "npm:lodash"; works correctly.
path module:
import path from "https://deno.land/std@0.203.0/node/path.ts";
const fullPath = path.join("/home/user", "docs", "file.txt");
console.log(fullPath);
What will be printed when you run this script on a Unix-like system?The polyfill provides Node.js path module functionality. On Unix systems, path.join uses forward slashes.
