The Node runtime
This part follows the program out of the type checker: the emitted JavaScript under Node.js, npm scripts, process.argv and process.env, fs, path and os, JSON files, dates, crypto random ids, timers and the exit code.
51
Run with Node
compile once, run the JavaScript with node, and read simple command line arguments
Open
52
npm scripts
build and start commands in the scripts map, run by name, chained with &&
Open
53
argv and env
process.argv, process.env and the default that keeps a setting safe
Open
54
Files with fs
read and write text files, round-trip JSON, and check a file exists first
Open
55
path and os
join path parts, find the folder of the script, and read a config location from os
Open
56
JSON IO
parse JSON into typed values, print it back, and guard a config against a bad shape
Open
57
Dates
dates, stable ISO strings, a difference between two stamps, and weekday names
Open
58
Crypto random
UUIDs and hex tokens from node crypto, and an id on each record
Open
59
Timers
setTimeout and setInterval, and the clear and unref that let a program end
Open
60
process
exit codes, a signal handled, and the directory and versions a program reads
Open