Node.js
18 steps in 8 sets of JavaScript.
JavaScript on the server. Modules and paths, the file system, streams, the process object, events and timers, network, and finally crypto and child processes.
Eighteen steps through the standard library, which has quietly become good enough that a lot of small tools need no dependencies at all.
Modules & paths
- ES modulesimport and export, with the named and default forms.
- Pathsjoin, resolve, and taking a filename apart.
Files
- Reading and writing filesThe promises API, awaited, with real errors.
- Walking a directoryreaddir with file types, and the recursive option.
Streams & lines
- StreamsReading a file in chunks, and the pipeline that wires stages together.
- Reading linesreadline turns a stream into lines, without loading the file.
The process
- The process objectArguments, environment, exit codes and the current directory.
- util and structured clonepromisify for callback APIs, and a deep copy that handles cycles.
- BuffersRaw bytes, and the encodings you convert them through.
Events & timers
- EventEmitterNode's own observer pattern, with once, off and error handling.
- Timers as promisesnode:timers/promises gives awaitable delays and intervals.
Network
- An HTTP servercreateServer, a request handler, and JSON out.
- fetch in NodeThe same fetch as the browser, with Node's error shapes.
- URLs and query stringsThe URL class parses; URLSearchParams handles the query.
Crypto & processes
- Hashing and random valuesDigests, UUIDs and the comparison that does not leak timing.
- Running a commandexecFile with an argument array, promisified and awaited.
- Worker threadsReal parallelism for CPU work, with messages between the threads.
Encore
- csv-report.jsA Node report: read a CSV, derive columns, group, and print a table.