All fields

“CLI Tools & Scripting with Node.js” in Information Technology

29 questions across 1 technology.

Information Technology

29 questions in 1 technology

#QuestionTechnologyTopicLevel
1What is a shebang line, and why does it need to be the first line of an executable Node.js CLI script? Node.js › CLI Tools & Scripting with Node.jsNode.jsCLI Tools & Scripting with Node.jsBeginner
2How would you parse command-line arguments and flags in a Node.js CLI tool using a library like commander or yargs? Node.js › CLI Tools & Scripting with Node.jsNode.jsCLI Tools & Scripting with Node.jsIntermediate
3How do you correctly set an exit code from a Node.js CLI script to signal success or failure to the calling shell or CI pipeline? Node.js › CLI Tools & Scripting with Node.jsNode.jsCLI Tools & Scripting with Node.jsIntermediate
4How do you write cross-platform shell scripts in Node.js that work identically on Windows, macOS, and Linux? Node.js › CLI Tools & Scripting with Node.jsNode.jsCLI Tools & Scripting with Node.jsIntermediate
5How would you build an interactive CLI wizard that prompts the user for multiple pieces of input using a library like Inquirer.js? Node.js › CLI Tools & Scripting with Node.jsNode.jsCLI Tools & Scripting with Node.jsAdvanced
6What is the difference between require() (CommonJS) and import (ES Modules) when loading Node.js's own core modules? Node.js › Core Node.js ModulesNode.jsCore Node.js ModulesBeginner
7How does Node.js's built-in test runner (node:test) compare to third-party frameworks like Jest or Mocha? Node.js › Advanced Node.jsNode.jsAdvanced Node.jsAdvanced
8What are Node.js Single Executable Applications (SEA), and what are their current limitations? Node.js › Advanced Node.jsNode.jsAdvanced Node.jsAdvanced
9How would you recursively read all files within a directory tree in Node.js? Node.js › File System & File ProcessingNode.jsFile System & File ProcessingIntermediate
10How would you implement a directory-size calculator in Node.js that recursively sums the size of all files within a directory tree? Node.js › File System & File ProcessingNode.jsFile System & File ProcessingAdvanced
11What does the node:os module provide, and what are some commonly used functions from it? Node.js › Core Node.js ModulesNode.jsCore Node.js ModulesBeginner
12What does the node:path module provide, and why should you always use it instead of manually concatenating file path strings? Node.js › Core Node.js ModulesNode.jsCore Node.js ModulesIntermediate
13What does the node:readline module provide, and what is a common use case for it? Node.js › Core Node.js ModulesNode.jsCore Node.js ModulesIntermediate
14What is the difference between an absolute path and a relative path in Node.js, and how does __dirname help resolve paths reliably? Node.js › File System & File ProcessingNode.jsFile System & File ProcessingBeginner
15What is the difference between fs.unlink() and fs.rmdir() (or the newer fs.rm()) in Node.js? Node.js › File System & File ProcessingNode.jsFile System & File ProcessingBeginner
16What are the four main methods for creating a child process in Node.js, and how do they differ? Node.js › Child Processes & Process ManagementNode.jsChild Processes & Process ManagementBeginner
17What is the process object in Node.js, and what are some of the most commonly used properties and methods on it? Node.js › Global Objects & the process ObjectNode.jsGlobal Objects & the process ObjectBeginner
18What is the difference between synchronous and asynchronous versions of the same core Node.js API, using fs.readFile vs fs.readFileSync as an example, and when is the synchronous version actually appropriate? Node.js › Event Loop & Non-blocking IONode.jsEvent Loop & Non-blocking IOIntermediate
19How would you pipe the output of one child process directly into the input of another, replicating a shell pipeline in Node.js? Node.js › Child Processes & Process ManagementNode.jsChild Processes & Process ManagementIntermediate
20How would you implement a file-watching feature in Node.js using fs.watch(), and what are its known cross-platform limitations? Node.js › File System & File ProcessingNode.jsFile System & File ProcessingAdvanced
21What is the difference between path.join() and path.resolve(), and when would you use each? Node.js › Path & OS ModulesNode.jsPath & OS ModulesBeginner
22What does path.parse() and path.format() do, and how are they useful for decomposing and reconstructing file paths? Node.js › Path & OS ModulesNode.jsPath & OS ModulesBeginner
23What is a database seed script, and how does it differ from a migration? Node.js › DatabasesNode.jsDatabasesIntermediate
24What is the difference between fs.stat() and fs.lstat(), and when does the distinction matter? Node.js › File System & File ProcessingNode.jsFile System & File ProcessingIntermediate
25What is the purpose of the 'flag' option in fs.writeFile(), and what's the difference between 'w', 'a', and 'wx' flags? Node.js › File System & File ProcessingNode.jsFile System & File ProcessingIntermediate
26What is the purpose of an npm 'scripts' section in package.json, and how do custom scripts standardize common project tasks across a team? Node.js › Git & Project ManagementNode.jsGit & Project ManagementIntermediate
27How do you safely watch a directory or file for changes using fs.watch(), and what are its known cross-platform limitations? Node.js › File System (fs) ModuleNode.jsFile System (fs) ModuleIntermediate
28How would you use the node:os module to make a script's behavior adapt correctly across different operating systems? Node.js › Path & OS ModulesNode.jsPath & OS ModulesIntermediate
29What is the 'detached' option when spawning a child process, and when would you use it? Node.js › Child Processes & Process ManagementNode.jsChild Processes & Process ManagementAdvanced