The NodeJS script was build for old NodeJS versions. In the current day and age we can write a lot cleaner code. The new script targets NodeJS v18 and above.
Notable differences:
ESM for top level await and import syntax
node: imports
Node's native promise based API for fs and setTimeout
File URLs over path joining
Optional chaining
Object.values and for...of looping instead of for...in looping
The NodeJS script was build for old NodeJS versions. In the current day and age we can write a lot cleaner code. The new script targets NodeJS v18 and above.
Notable differences:
import
syntaxnode:
importsfs
andsetTimeout
Object.values
andfor...of
looping instead offor...in
looping